rb-readline 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+ require 'rbreadline'
3
+
4
+ class TC_RbReadline < Test::Unit::TestCase
5
+ def test_versions
6
+ assert_equal('5.2', RbReadline::RL_LIBRARY_VERSION)
7
+ assert_equal(0x0502, RbReadline::RL_READLINE_VERSION)
8
+ end
9
+ end
@@ -0,0 +1,130 @@
1
+ require 'test/unit'
2
+ require 'readline'
3
+
4
+ class TC_Readline < Test::Unit::TestCase
5
+ def setup
6
+ @proc = proc{ |s| ['alpha', 'beta'].grep( /^#{Regexp.escape(s)}/) }
7
+ end
8
+
9
+ def test_version
10
+ assert_equal('5.2', Readline::VERSION)
11
+ end
12
+
13
+ def test_readline_basic
14
+ assert_respond_to(Readline, :readline)
15
+ end
16
+
17
+ def test_readline_expected_errors
18
+ assert_raise(ArgumentError){ Readline.readline }
19
+ end
20
+
21
+ def test_input_basic
22
+ assert_respond_to(Readline, :input=)
23
+ end
24
+
25
+ def test_input
26
+ assert_nothing_raised{ Readline.input = $stdin }
27
+ end
28
+
29
+ def test_output_basic
30
+ assert_respond_to(Readline, :output=)
31
+ end
32
+
33
+ def test_output
34
+ assert_nothing_raised{ Readline.output = $stdout }
35
+ end
36
+
37
+ def test_completion_proc_get_basic
38
+ assert_respond_to(Readline, :completion_proc)
39
+ end
40
+
41
+ def test_completion_proc_set_basic
42
+ assert_respond_to(Readline, :completion_proc=)
43
+ end
44
+
45
+ def test_completion_proc
46
+ assert_nothing_raised{ Readline.completion_proc = @proc }
47
+ end
48
+
49
+ def test_completion_case_fold_get_basic
50
+ assert_respond_to(Readline, :completion_case_fold)
51
+ end
52
+
53
+ def test_completion_case_fold_default
54
+ assert_equal(false, Readline.completion_case_fold) # default
55
+ end
56
+
57
+ def test_completion_case_fold_set_basic
58
+ assert_respond_to(Readline, :completion_case_fold=)
59
+ end
60
+
61
+ def test_completion_case_fold_changed
62
+ assert_nothing_raised{ Readline.completion_case_fold = false }
63
+ end
64
+
65
+ def test_completion_proc_expected_errors
66
+ assert_raise(ArgumentError){ Readline.completion_proc = 1 }
67
+ assert_raise(ArgumentError){ Readline.completion_proc = 'a' }
68
+ end
69
+
70
+ def test_vi_editing_mode_basic
71
+ assert_respond_to(Readline, :vi_editing_mode)
72
+ end
73
+
74
+ def test_emacs_editing_mode_basic
75
+ assert_respond_to(Readline, :emacs_editing_mode)
76
+ end
77
+
78
+ def test_completion_append_character_get_basic
79
+ assert_respond_to(Readline, :completion_append_character)
80
+ end
81
+
82
+ def test_completion_append_character_get
83
+ assert_equal(' ', Readline.completion_append_character) # default
84
+ end
85
+
86
+ def test_completion_append_character_set_basic
87
+ assert_respond_to(Readline, :completion_append_character=)
88
+ end
89
+
90
+ def test_completion_append_character_set
91
+ assert_nothing_raised{ Readline.completion_append_character }
92
+ end
93
+
94
+ def test_basic_word_break_characters_get_basic
95
+ assert_respond_to(Readline, :basic_word_break_characters)
96
+ end
97
+
98
+ def test_basic_word_break_characters_get
99
+ assert_equal(" \t\n\"\\'`@$><=|&{(", Readline.basic_word_break_characters)
100
+ end
101
+
102
+ def test_basic_word_break_characters_set_basic
103
+ assert_respond_to(Readline, :basic_word_break_characters=)
104
+ end
105
+
106
+ def test_basic_word_break_characters_set
107
+ assert_nothing_raised{ Readline.basic_word_break_characters = " \t\n\"\\'`@$><=|&{(" }
108
+ end
109
+
110
+ def test_basic_quote_characters_get_basic
111
+ assert_respond_to(Readline, :basic_quote_characters)
112
+ end
113
+
114
+ def test_basic_quote_characters_get
115
+ assert_nothing_raised{ Readline.basic_quote_characters }
116
+ assert_equal("\"'", Readline.basic_quote_characters)
117
+ end
118
+
119
+ def test_basic_quote_characters_set_basic
120
+ assert_respond_to(Readline, :basic_quote_characters=)
121
+ end
122
+
123
+ def test_basic_quote_characters_set
124
+ assert_nothing_raised{ Readline.basic_quote_characters = "\"'" }
125
+ end
126
+
127
+ def teardown
128
+ @proc = nil
129
+ end
130
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rb-readline
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
+ platform: ruby
12
+ authors:
13
+ - Park Heesob
14
+ - Daniel Berger
15
+ - Luis Lavena
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-01-10 00:00:00 -03:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rake
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: The readline library provides a pure Ruby implementation of the GNU readline C library, as well as the Readline extension that ships as part of the standard library.
38
+ email:
39
+ - phasis@gmail.com
40
+ - djberg96@gmail.com
41
+ - luislavena@gmail.com
42
+ executables: []
43
+
44
+ extensions: []
45
+
46
+ extra_rdoc_files:
47
+ - README
48
+ - LICENSE
49
+ - CHANGES
50
+ files:
51
+ - examples/example_readline.rb
52
+ - examples/example_readline_with_completion.rb
53
+ - examples/tinyirb.rb
54
+ - lib/rb-readline.rb
55
+ - lib/rbreadline.rb
56
+ - lib/readline.rb
57
+ - test/test_rbreadline.rb
58
+ - test/test_readline.rb
59
+ - README
60
+ - LICENSE
61
+ - CHANGES
62
+ - Rakefile
63
+ - setup.rb
64
+ has_rdoc: true
65
+ homepage: http://github.com/luislavena/rb-readline
66
+ licenses:
67
+ - BSD
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --main
71
+ - README
72
+ - --title
73
+ - Rb-Readline - Documentation
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 59
82
+ segments:
83
+ - 1
84
+ - 8
85
+ - 6
86
+ version: 1.8.6
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 17
93
+ segments:
94
+ - 1
95
+ - 3
96
+ - 5
97
+ version: 1.3.5
98
+ requirements: []
99
+
100
+ rubyforge_project:
101
+ rubygems_version: 1.4.2
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Pure-Ruby Readline Implementation
105
+ test_files: []
106
+