rib 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +8 -6
- data/CHANGES.md +8 -0
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/lib/rib/core/multiline.rb +3 -0
- data/lib/rib/extra/autoindent.rb +11 -14
- data/lib/rib/test/multiline.rb +24 -24
- data/lib/rib/test.rb +43 -47
- data/lib/rib/version.rb +1 -1
- data/rib.gemspec +6 -6
- data/task/gemgem.rb +1 -5
- data/test/core/test_completion.rb +2 -2
- data/test/core/test_history.rb +8 -8
- data/test/core/test_multiline.rb +3 -3
- data/test/core/test_readline.rb +5 -5
- data/test/core/test_squeeze_history.rb +6 -6
- data/test/core/test_underscore.rb +6 -6
- data/test/extra/test_autoindent.rb +141 -0
- data/test/more/test_color.rb +4 -4
- data/test/more/test_multiline_history.rb +3 -3
- data/test/test_api.rb +2 -2
- data/test/test_plugin.rb +3 -3
- data/test/test_runner.rb +5 -5
- data/test/test_shell.rb +20 -20
- metadata +5 -5
- data/lib/rib/extra/debugger.rb +0 -146
- data/lib/rib/patch/debugger.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2150377cb877771f501f288373ccf7750a786be5
|
4
|
+
data.tar.gz: 72a3bc6e08131e09ede6e1b81b16a904e8080244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a3ac832fc847890ca41e7fbcf4760e0c1a1b46d1f07d71135bf5bc1e117af114be038319cb18a85bd348b074845e86bcf8d300ab260662f10239dca96229ca
|
7
|
+
data.tar.gz: 60f6eeeee1bb056cd56ca103c198c7cf7fcf0cfe1d288dcafe5ac2b8658ea75d96aad163dd735defd59af5065c30abd45b15ebd5e530edb2136d154d1efef21b
|
data/.travis.yml
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
before_install: 'git submodule update --init'
|
2
|
-
script: 'ruby -r bundler/setup -S rake test'
|
3
1
|
|
2
|
+
language: ruby
|
4
3
|
rvm:
|
5
|
-
- 1.9
|
6
|
-
- 2.0
|
7
|
-
-
|
8
|
-
- rbx
|
4
|
+
- 1.9
|
5
|
+
- 2.0
|
6
|
+
- 2.1
|
7
|
+
- rbx-2
|
9
8
|
- jruby
|
10
9
|
|
11
10
|
matrix:
|
12
11
|
allow_failures:
|
13
12
|
- rvm: jruby
|
13
|
+
|
14
|
+
script: 'ruby -r bundler/setup -S rake test'
|
15
|
+
sudo: false
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Rib 1.2.6 -- 2014-11-07
|
4
|
+
|
5
|
+
* [extra/autoindent] Now `module_function` would indent correctly.
|
6
|
+
* [extra/autoindent] Now `else` in `case` would indent correctly.
|
7
|
+
* [extra/autoindent] Fixed printing end clause twice. (performance fix)
|
8
|
+
* [extra/multiline] Fixed in some cases it's not recognized as multiline
|
9
|
+
in Rubinius (rbx).
|
10
|
+
|
3
11
|
## Rib 1.2.5 -- 2014-03-13
|
4
12
|
|
5
13
|
* Fixed binding. Sorry my bad.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -23,7 +23,7 @@ be simple, lightweight and modular so that everyone could customize Rib.
|
|
23
23
|
|
24
24
|
## REQUIREMENTS:
|
25
25
|
|
26
|
-
* Tested with MRI (official CRuby)
|
26
|
+
* Tested with MRI (official CRuby), Rubinius and JRuby.
|
27
27
|
* All gem dependencies are optional, but it's highly recommended to use
|
28
28
|
Rib with [bond][] for tab completion.
|
29
29
|
|
data/lib/rib/core/multiline.rb
CHANGED
@@ -49,6 +49,9 @@ module Rib::Multiline
|
|
49
49
|
"syntax error, unexpected \\$end" ,
|
50
50
|
# rubinius
|
51
51
|
"expecting keyword_end" ,
|
52
|
+
"expecting keyword_then" ,
|
53
|
+
"expecting keyword_when" ,
|
54
|
+
"expecting keyword_do_cond" ,
|
52
55
|
"expecting \\$end" ,
|
53
56
|
"expecting '.+'( or '.+')*" ,
|
54
57
|
"missing '.+' for '.+' started on line \\d+"].join('|'))
|
data/lib/rib/extra/autoindent.rb
CHANGED
@@ -24,21 +24,21 @@ module Rib::Autoindent
|
|
24
24
|
# rescue E => e
|
25
25
|
# rescue E=> e
|
26
26
|
# rescue E =>e
|
27
|
-
/^begin$/
|
27
|
+
/^begin$/ => /^(end)\b|^else$|^rescue *((\w+)? *(=> *\w+)?)?$/,
|
28
28
|
# elsif Expression
|
29
29
|
# consider cases:
|
30
30
|
# elsif(true)
|
31
31
|
# elsif true
|
32
32
|
# elsif true == true
|
33
33
|
# elsif (a = true) && false
|
34
|
-
/^if/ => /^(end)\b|^else$|^elsif\b/,
|
35
|
-
/^unless/ => /^(end)\b|^else$|^elsif\b/,
|
36
|
-
/^case/ => /^(end)\b|^when\b/
|
37
|
-
/^def/ => /^(end)\b/ ,
|
38
|
-
/^class/ => /^(end)\b/ ,
|
39
|
-
/^module/ => /^(end)\b/ ,
|
40
|
-
/^while/ => /^(end)\b/ ,
|
41
|
-
/^until/ => /^(end)\b/ ,
|
34
|
+
/^if\b/ => /^(end)\b|^else$|^elsif\b/,
|
35
|
+
/^unless\b/ => /^(end)\b|^else$|^elsif\b/,
|
36
|
+
/^case\b/ => /^(end)\b|^else$|when\b/ ,
|
37
|
+
/^def\b/ => /^(end)\b/ ,
|
38
|
+
/^class\b/ => /^(end)\b/ ,
|
39
|
+
/^module\b/ => /^(end)\b/ ,
|
40
|
+
/^while\b/ => /^(end)\b/ ,
|
41
|
+
/^until\b/ => /^(end)\b/ ,
|
42
42
|
# consider cases:
|
43
43
|
# 'do
|
44
44
|
# ' do
|
@@ -88,11 +88,7 @@ module Rib::Autoindent
|
|
88
88
|
return super if Autoindent.disabled?
|
89
89
|
input = raw_input.strip
|
90
90
|
indent = detect_autoindent(input)
|
91
|
-
result, err =
|
92
|
-
super(handle_last_line(input))
|
93
|
-
else
|
94
|
-
super
|
95
|
-
end
|
91
|
+
result, err = super
|
96
92
|
handle_autoindent(input, indent, err)
|
97
93
|
[result, err]
|
98
94
|
end
|
@@ -128,6 +124,7 @@ module Rib::Autoindent
|
|
128
124
|
|
129
125
|
when :left_end # we need to go back
|
130
126
|
# could happen in either multiline or not
|
127
|
+
handle_last_line(input)
|
131
128
|
autoindent_stack.pop
|
132
129
|
|
133
130
|
when :left_tmp # temporarily go back
|
data/lib/rib/test/multiline.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
copy :setup_multiline do
|
3
3
|
def setup_shell
|
4
4
|
@shell = Rib::Shell.new(
|
5
5
|
:binding => Object.new.instance_eval{binding}).before_loop
|
@@ -34,12 +34,12 @@ shared :setup_multiline do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
copy :multiline do
|
38
38
|
before do
|
39
39
|
setup_shell
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
would 'work with no prompt' do
|
43
43
|
@shell.config[:prompt] = ''
|
44
44
|
check <<-RUBY
|
45
45
|
def f
|
@@ -48,7 +48,7 @@ shared :multiline do
|
|
48
48
|
RUBY
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
would 'def f' do
|
52
52
|
check <<-RUBY
|
53
53
|
def f
|
54
54
|
1
|
@@ -56,21 +56,21 @@ shared :multiline do
|
|
56
56
|
RUBY
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
would 'class C' do
|
60
60
|
check <<-RUBY
|
61
61
|
class C
|
62
62
|
end
|
63
63
|
RUBY
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
would 'begin' do
|
67
67
|
check <<-RUBY
|
68
68
|
begin
|
69
69
|
end
|
70
70
|
RUBY
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
would 'begin with RuntimeError' do
|
74
74
|
check <<-RUBY, RuntimeError
|
75
75
|
begin
|
76
76
|
raise 'multiline raised an error'
|
@@ -78,118 +78,118 @@ shared :multiline do
|
|
78
78
|
RUBY
|
79
79
|
end
|
80
80
|
|
81
|
-
|
81
|
+
would 'do end' do
|
82
82
|
check <<-RUBY
|
83
83
|
[].each do
|
84
84
|
end
|
85
85
|
RUBY
|
86
86
|
end
|
87
87
|
|
88
|
-
|
88
|
+
would 'block brace' do
|
89
89
|
check <<-RUBY
|
90
90
|
[].each{
|
91
91
|
}
|
92
92
|
RUBY
|
93
93
|
end
|
94
94
|
|
95
|
-
|
95
|
+
would 'hash' do
|
96
96
|
check <<-RUBY
|
97
97
|
{
|
98
98
|
}
|
99
99
|
RUBY
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
would 'hash value' do
|
103
103
|
check <<-RUBY
|
104
104
|
{1 =>
|
105
105
|
2}
|
106
106
|
RUBY
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
would 'array' do
|
110
110
|
check <<-RUBY
|
111
111
|
[
|
112
112
|
]
|
113
113
|
RUBY
|
114
114
|
end
|
115
115
|
|
116
|
-
|
116
|
+
would 'group' do
|
117
117
|
check <<-RUBY
|
118
118
|
(
|
119
119
|
)
|
120
120
|
RUBY
|
121
121
|
end
|
122
122
|
|
123
|
-
|
123
|
+
would 'string double quote' do
|
124
124
|
check <<-RUBY
|
125
125
|
"
|
126
126
|
"
|
127
127
|
RUBY
|
128
128
|
end
|
129
129
|
|
130
|
-
|
130
|
+
would 'string single quote' do
|
131
131
|
check <<-RUBY
|
132
132
|
'
|
133
133
|
'
|
134
134
|
RUBY
|
135
135
|
end
|
136
136
|
|
137
|
-
|
137
|
+
would 'be hash treated as a block SyntaxError' do
|
138
138
|
check <<-RUBY, SyntaxError
|
139
139
|
puts { :x => 10 }.class
|
140
140
|
RUBY
|
141
141
|
end
|
142
142
|
|
143
|
-
|
143
|
+
would 'begin with SyntaxError' do
|
144
144
|
check <<-RUBY, SyntaxError
|
145
145
|
begin
|
146
146
|
s-y n
|
147
147
|
RUBY
|
148
148
|
end
|
149
149
|
|
150
|
-
|
150
|
+
would 'binary operator +' do
|
151
151
|
check <<-RUBY
|
152
152
|
1/1.to_i +
|
153
153
|
1
|
154
154
|
RUBY
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
would 'binary operator -' do
|
158
158
|
check <<-RUBY
|
159
159
|
1*1.to_i -
|
160
160
|
1
|
161
161
|
RUBY
|
162
162
|
end
|
163
163
|
|
164
|
-
|
164
|
+
would 'binary operator *' do
|
165
165
|
check <<-RUBY
|
166
166
|
1-1.to_i *
|
167
167
|
1
|
168
168
|
RUBY
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
would 'binary operator /' do
|
172
172
|
check <<-RUBY
|
173
173
|
1+1.to_i /
|
174
174
|
1
|
175
175
|
RUBY
|
176
176
|
end
|
177
177
|
|
178
|
-
|
178
|
+
would 'binary operator |' do
|
179
179
|
check <<-RUBY
|
180
180
|
1+1.to_i |
|
181
181
|
1
|
182
182
|
RUBY
|
183
183
|
end
|
184
184
|
|
185
|
-
|
185
|
+
would 'binary operator &' do
|
186
186
|
check <<-RUBY
|
187
187
|
1+1.to_i &
|
188
188
|
1
|
189
189
|
RUBY
|
190
190
|
end
|
191
191
|
|
192
|
-
|
192
|
+
would 'binary operator ^' do
|
193
193
|
check <<-RUBY
|
194
194
|
1+1.to_i ^
|
195
195
|
1
|
data/lib/rib/test.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'pork/auto'
|
3
3
|
require 'muack'
|
4
4
|
require 'fileutils'
|
5
|
-
|
6
|
-
include Muack::API
|
5
|
+
|
6
|
+
Pork::Executor.__send__(:include, Muack::API)
|
7
7
|
|
8
8
|
require 'rib'
|
9
9
|
|
10
|
-
|
10
|
+
copy :rib do
|
11
11
|
before do
|
12
12
|
end
|
13
13
|
|
@@ -15,48 +15,50 @@ shared :rib do
|
|
15
15
|
Muack.verify
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
singleton_class.module_eval do
|
19
|
+
def test_for *plugins, &block
|
20
|
+
require 'rib/all' # exhaustive tests
|
21
|
+
rest = Rib.plugins - plugins
|
22
|
+
Rib.enable_plugins(plugins)
|
23
|
+
Rib.disable_plugins(rest)
|
24
|
+
yield
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
case ENV['TEST_LEVEL']
|
27
|
+
when '0'
|
28
|
+
when '1'
|
29
|
+
test_level1(rest, block)
|
30
|
+
when '2'
|
31
|
+
test_level2(rest, block)
|
32
|
+
when '3'
|
33
|
+
test_level3(rest, block)
|
34
|
+
else # test_level3 is too slow because of rr (i guess)
|
35
|
+
test_level2(rest, block)
|
36
|
+
end
|
35
37
|
end
|
36
|
-
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
def test_level1 rest, block
|
40
|
+
rest.each{ |target|
|
41
|
+
target.enable
|
42
|
+
block.call
|
43
|
+
target.disable
|
44
|
+
}
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
def test_level2 rest, block
|
48
|
+
rest.combination(2).each{ |targets|
|
49
|
+
Rib.enable_plugins(targets)
|
50
|
+
block.call
|
51
|
+
Rib.disable_plugins(targets)
|
52
|
+
}
|
53
|
+
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
def test_level3 rest, block
|
56
|
+
return block.call if rest.empty?
|
57
|
+
rest[0].enable
|
58
|
+
test_level3(rest[1..-1], block)
|
59
|
+
rest[0].disable
|
60
|
+
test_level3(rest[1..-1], block)
|
61
|
+
end
|
60
62
|
end
|
61
63
|
|
62
64
|
def readline?
|
@@ -71,12 +73,6 @@ shared :rib do
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
74
|
-
module Kernel
|
75
|
-
def eq? rhs
|
76
|
-
self == rhs
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
76
|
def main
|
81
77
|
'rib'
|
82
78
|
end
|
data/lib/rib/version.rb
CHANGED
data/rib.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rib 1.2.
|
2
|
+
# stub: rib 1.2.6 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rib"
|
6
|
-
s.version = "1.2.
|
6
|
+
s.version = "1.2.6"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "2014-
|
11
|
+
s.date = "2014-11-07"
|
12
12
|
s.description = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell\n\nRib is based on the design of [ripl][] and the work of [ripl-rc][], some of\nthe features are also inspired by [pry][]. The aim of Rib is to be fully\nfeatured and yet very easy to opt-out or opt-in other features. It shall\nbe simple, lightweight and modular so that everyone could customize Rib.\n\n[ripl]: https://github.com/cldwalker/ripl\n[ripl-rc]: https://github.com/godfat/ripl-rc\n[pry]: https://github.com/pry/pry"
|
13
13
|
s.email = ["godfat (XD) godfat.org"]
|
14
14
|
s.executables = [
|
@@ -54,7 +54,6 @@ Gem::Specification.new do |s|
|
|
54
54
|
"lib/rib/core/underscore.rb",
|
55
55
|
"lib/rib/debug.rb",
|
56
56
|
"lib/rib/extra/autoindent.rb",
|
57
|
-
"lib/rib/extra/debugger.rb",
|
58
57
|
"lib/rib/extra/hirb.rb",
|
59
58
|
"lib/rib/extra/paging.rb",
|
60
59
|
"lib/rib/more.rb",
|
@@ -63,7 +62,6 @@ Gem::Specification.new do |s|
|
|
63
62
|
"lib/rib/more/edit.rb",
|
64
63
|
"lib/rib/more/multiline_history.rb",
|
65
64
|
"lib/rib/more/multiline_history_file.rb",
|
66
|
-
"lib/rib/patch/debugger.rb",
|
67
65
|
"lib/rib/plugin.rb",
|
68
66
|
"lib/rib/runner.rb",
|
69
67
|
"lib/rib/shell.rb",
|
@@ -80,6 +78,7 @@ Gem::Specification.new do |s|
|
|
80
78
|
"test/core/test_readline.rb",
|
81
79
|
"test/core/test_squeeze_history.rb",
|
82
80
|
"test/core/test_underscore.rb",
|
81
|
+
"test/extra/test_autoindent.rb",
|
83
82
|
"test/more/test_color.rb",
|
84
83
|
"test/more/test_multiline_history.rb",
|
85
84
|
"test/test_api.rb",
|
@@ -88,7 +87,7 @@ Gem::Specification.new do |s|
|
|
88
87
|
"test/test_shell.rb"]
|
89
88
|
s.homepage = "https://github.com/godfat/rib"
|
90
89
|
s.licenses = ["Apache License 2.0"]
|
91
|
-
s.rubygems_version = "2.
|
90
|
+
s.rubygems_version = "2.4.2"
|
92
91
|
s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell"
|
93
92
|
s.test_files = [
|
94
93
|
"test/core/test_completion.rb",
|
@@ -97,6 +96,7 @@ Gem::Specification.new do |s|
|
|
97
96
|
"test/core/test_readline.rb",
|
98
97
|
"test/core/test_squeeze_history.rb",
|
99
98
|
"test/core/test_underscore.rb",
|
99
|
+
"test/extra/test_autoindent.rb",
|
100
100
|
"test/more/test_color.rb",
|
101
101
|
"test/more/test_multiline_history.rb",
|
102
102
|
"test/test_api.rb",
|
data/task/gemgem.rb
CHANGED
@@ -34,7 +34,7 @@ module Gemgem
|
|
34
34
|
s.executables = bin_files
|
35
35
|
end
|
36
36
|
spec_create.call(spec)
|
37
|
-
spec.homepage
|
37
|
+
spec.homepage ||= "https://github.com/godfat/#{spec.name}"
|
38
38
|
self.spec = spec
|
39
39
|
end
|
40
40
|
|
@@ -227,10 +227,6 @@ end # of gem namespace
|
|
227
227
|
desc 'Run tests'
|
228
228
|
task :test do
|
229
229
|
next if Gemgem.test_files.empty?
|
230
|
-
|
231
|
-
require 'bacon'
|
232
|
-
Bacon.extend(Bacon::TestUnitOutput)
|
233
|
-
Bacon.summary_on_exit
|
234
230
|
Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
|
235
231
|
end
|
236
232
|
|
@@ -3,7 +3,7 @@ require 'rib/test'
|
|
3
3
|
require 'rib/core/completion'
|
4
4
|
|
5
5
|
describe Rib::Completion do
|
6
|
-
|
6
|
+
paste :rib
|
7
7
|
|
8
8
|
before do
|
9
9
|
@completion = Class.new do
|
@@ -11,7 +11,7 @@ describe Rib::Completion do
|
|
11
11
|
end.new
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
would 'find correct ripl plugins' do
|
15
15
|
$LOADED_FEATURES << '/dir/ripl/some_plugin.rb'
|
16
16
|
@completion.send(:ripl_plugins).should.eq ['ripl/some_plugin.rb']
|
17
17
|
end
|
data/test/core/test_history.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require 'rib/test'
|
3
3
|
require 'rib/core/history'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
copy :history do
|
6
|
+
would '#after_loop save history' do
|
7
7
|
inputs = %w[blih blah]
|
8
8
|
@shell.history.clear
|
9
9
|
@shell.history.push(*inputs)
|
@@ -12,18 +12,18 @@ shared :history do
|
|
12
12
|
File.read(@history_file).should.eq "#{inputs.join("\n")}\n"
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
would '#before_loop load previous history' do
|
16
16
|
File.open(@history_file, 'w'){ |f| f.write "check\nthe\nmike" }
|
17
17
|
@shell.before_loop
|
18
18
|
@shell.history.to_a.should.eq %w[check the mike]
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
would '#before_loop have empty history if no history file exists' do
|
22
22
|
@shell.before_loop
|
23
23
|
@shell.history.to_a.should.eq []
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
would '#read_history be accessible to plugins in #before_loop' do
|
27
27
|
mod = Module.new do
|
28
28
|
def read_history
|
29
29
|
config[:history] = ['pong_read_history']
|
@@ -34,7 +34,7 @@ shared :history do
|
|
34
34
|
shell.new.before_loop.history.should.eq ['pong_read_history']
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
would '#write_history be accessible to plugins in #after_loop' do
|
38
38
|
mod = Module.new do
|
39
39
|
def write_history
|
40
40
|
config[:history] = ['pong_write_history']
|
@@ -47,7 +47,7 @@ shared :history do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe Rib::History do
|
50
|
-
|
50
|
+
paste :rib
|
51
51
|
|
52
52
|
before do
|
53
53
|
if readline?
|
@@ -63,6 +63,6 @@ describe Rib::History do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
test_for Rib::History do
|
66
|
-
|
66
|
+
paste :history
|
67
67
|
end
|
68
68
|
end
|
data/test/core/test_multiline.rb
CHANGED
@@ -4,8 +4,8 @@ require 'rib/test/multiline'
|
|
4
4
|
require 'rib/core/multiline'
|
5
5
|
|
6
6
|
describe Rib::Multiline do
|
7
|
-
|
8
|
-
|
7
|
+
paste :rib
|
8
|
+
paste :setup_multiline
|
9
9
|
|
10
10
|
def check str, err=nil
|
11
11
|
lines = str.split("\n")
|
@@ -17,6 +17,6 @@ describe Rib::Multiline do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
test_for Rib::Multiline do
|
20
|
-
|
20
|
+
paste :multiline
|
21
21
|
end
|
22
22
|
end
|
data/test/core/test_readline.rb
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
require 'rib/test'
|
3
3
|
require 'rib/core/readline'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
copy :readline do
|
6
|
+
would '#before_loop set @history' do
|
7
7
|
@shell.history.should.eq Readline::HISTORY
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
would '#get_input calling Readline.readline' do
|
11
11
|
mock(Readline).readline(@shell.prompt, true){'ok'}
|
12
12
|
@shell.get_input.should.eq 'ok'
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe Rib::Readline do
|
17
|
-
|
17
|
+
paste :rib
|
18
18
|
|
19
19
|
before do
|
20
20
|
@shell = Rib::Shell.new.before_loop
|
21
21
|
end
|
22
22
|
|
23
23
|
test_for Rib::Readline do
|
24
|
-
|
24
|
+
paste :readline
|
25
25
|
end
|
26
26
|
end
|