bond 0.4.2-java

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.
Files changed (46) hide show
  1. data/.gemspec +28 -0
  2. data/.travis.yml +8 -0
  3. data/CHANGELOG.rdoc +91 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.rdoc +242 -0
  6. data/Rakefile +47 -0
  7. data/lib/bond.rb +127 -0
  8. data/lib/bond/agent.rb +108 -0
  9. data/lib/bond/completion.rb +16 -0
  10. data/lib/bond/completions/activerecord.rb +12 -0
  11. data/lib/bond/completions/array.rb +1 -0
  12. data/lib/bond/completions/bond.rb +6 -0
  13. data/lib/bond/completions/hash.rb +3 -0
  14. data/lib/bond/completions/kernel.rb +15 -0
  15. data/lib/bond/completions/module.rb +10 -0
  16. data/lib/bond/completions/object.rb +21 -0
  17. data/lib/bond/completions/struct.rb +1 -0
  18. data/lib/bond/input.rb +28 -0
  19. data/lib/bond/m.rb +146 -0
  20. data/lib/bond/mission.rb +151 -0
  21. data/lib/bond/missions/anywhere_mission.rb +15 -0
  22. data/lib/bond/missions/default_mission.rb +21 -0
  23. data/lib/bond/missions/method_mission.rb +197 -0
  24. data/lib/bond/missions/object_mission.rb +44 -0
  25. data/lib/bond/missions/operator_method_mission.rb +27 -0
  26. data/lib/bond/rc.rb +48 -0
  27. data/lib/bond/readline.rb +38 -0
  28. data/lib/bond/readlines/jruby.rb +13 -0
  29. data/lib/bond/readlines/rawline.rb +15 -0
  30. data/lib/bond/readlines/ruby.rb +9 -0
  31. data/lib/bond/search.rb +74 -0
  32. data/lib/bond/version.rb +3 -0
  33. data/test/agent_test.rb +235 -0
  34. data/test/anywhere_mission_test.rb +34 -0
  35. data/test/bond_test.rb +141 -0
  36. data/test/completion_test.rb +148 -0
  37. data/test/completions_test.rb +98 -0
  38. data/test/deps.rip +4 -0
  39. data/test/m_test.rb +34 -0
  40. data/test/method_mission_test.rb +246 -0
  41. data/test/mission_test.rb +51 -0
  42. data/test/object_mission_test.rb +59 -0
  43. data/test/operator_method_mission_test.rb +66 -0
  44. data/test/search_test.rb +140 -0
  45. data/test/test_helper.rb +69 -0
  46. metadata +167 -0
@@ -0,0 +1,3 @@
1
+ module Bond
2
+ VERSION = '0.4.2'
3
+ end
@@ -0,0 +1,235 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "Agent" do
4
+ describe "#call" do
5
+ before { Bond.agent.reset }
6
+
7
+ it "chooses default mission if no missions match" do
8
+ complete(:on=>/bling/) {|e| [] }
9
+ Bond.agent.default_mission.expects(:execute).with {|e| e.is_a?(Input) }
10
+ tab 'blah'
11
+ end
12
+
13
+ it "for internal Bond error completes error" do
14
+ complete(:on=>/bling/) {|e| [] }
15
+ Bond.agent.expects(:find_mission).raises('wtf')
16
+ errors = tab('bling')
17
+ errors[0].should =~ /Bond Error: Failed internally.*'wtf'/
18
+ errors[1].should =~ /Please/
19
+ end
20
+
21
+ it "allows the readline buffer to be provided as an argument" do
22
+ Bond.agent.weapon.stubs(:line_buffer).raises(Exception)
23
+ should.not.raise { Bond.agent.call('bl', 'bl foo') }
24
+ end
25
+
26
+ def complete_error(msg)
27
+ lambda {|e|
28
+ e[0].should =~ msg
29
+ e[1].should =~ /Completion Info: Matches.*blah/
30
+ }
31
+ end
32
+
33
+ it "for completion action raising error completes error" do
34
+ Bond.config[:debug] = false
35
+ complete(:on=>/blah/) { raise 'blah' }
36
+ errors = tab('blah')
37
+ errors.size.should == 2
38
+ errors.should complete_error(/Bond Error: Failed.*action.*'blah'/)
39
+ Bond.config[:debug] = true
40
+ end
41
+
42
+ it "for completion action raising error with debug completes error and stacktrace" do
43
+ complete(:on=>/blah/) { raise 'blah' }
44
+ errors = tab('blah')
45
+ errors.size.should == 3
46
+ errors.should complete_error(/Bond Error: Failed.*action.*'blah'/)
47
+ errors[2].should =~ /Stack Trace:/
48
+ end
49
+
50
+ it "for completion action raising NoMethodError completes error" do
51
+ complete(:on=>/blah/) { raise NoMethodError }
52
+ tab('blah').should complete_error(/Bond Error: Failed.*action.*'NoMethodError'/)
53
+ end
54
+
55
+ it 'for completion action failing with Rc.eval completes empty' do
56
+ Bond.config[:debug] = false
57
+ complete(:on=>/blah/) { Rc.eval '{[}'}
58
+ tab('blah').should == []
59
+ Bond.config[:debug] = true
60
+ end
61
+
62
+ it 'for completion action failing with Rc.eval and debug completes error' do
63
+ complete(:on=>/blah/) { Rc.eval('{[}') || [] }
64
+ tab('blah').should complete_error(/Bond Error: Failed.*action.*(syntax|expect)/m)
65
+ end
66
+
67
+ it "for completion action raising SyntaxError in eval completes error" do
68
+ complete(:on=>/blah/) { eval '{[}'}
69
+ tab('blah').should complete_error(/Bond Error: Failed.*action.*(eval)/)
70
+ end
71
+
72
+ it "for completion action that doesn't exist completes error" do
73
+ complete(:on=>/blah/, :action=>:huh)
74
+ tab('blah').should complete_error(/Bond Error:.*action 'huh' doesn't exist/)
75
+ end
76
+
77
+ it "for completion search raising error completes error" do
78
+ Rc.module_eval "def blah_search(*args); raise 'blah'; end"
79
+ complete(:on=>/blah/, :search=>:blah) { [1] }
80
+ tab('blah').should complete_error(/Bond Error: Failed.*search.*'blah'/)
81
+ end
82
+
83
+ it "for completion search that doesn't exist completes error" do
84
+ complete(:on=>/blah/, :search=>:huh) { [] }
85
+ tab('blah').should complete_error(/Bond Error:.*search 'huh' doesn't exist/)
86
+ end
87
+ end
88
+
89
+ describe "complete" do
90
+ before {|e| Bond.agent.reset }
91
+ def complete_prints_error(msg, *args, &block)
92
+ capture_stderr { complete(*args, &block) }.should =~ msg
93
+ end
94
+
95
+ it "with no :action prints error" do
96
+ complete_prints_error /Invalid :action/, :on=>/blah/
97
+ end
98
+
99
+ it "with no :on prints error" do
100
+ complete_prints_error(/Invalid :on/) { [] }
101
+ end
102
+
103
+ it "with invalid :on prints error" do
104
+ complete_prints_error(/Invalid :on/, :on=>'blah') { [] }
105
+ end
106
+
107
+ it "with internal failure prints error" do
108
+ Mission.expects(:create).raises(RuntimeError, 'blah')
109
+ complete_prints_error(/Unexpected error.*blah/, :on=>/blah/) { [] }
110
+ end
111
+
112
+ it "with invalid :anywhere and :prefix prints no error" do
113
+ complete_prints_error(/^$/, :prefix=>nil, :anywhere=>:blah) {}
114
+ end
115
+
116
+ it "with invalid :object prints no error" do
117
+ complete_prints_error(/^$/, :object=>:Mod) {}
118
+ end
119
+
120
+ it "with invalid :method prints error" do
121
+ complete_prints_error(/Invalid.*:method\(s\)/, :method=>true) {}
122
+ end
123
+
124
+ it "with invalid array :method prints error" do
125
+ complete_prints_error(/Invalid array :method/, :method=>%w{one two}) {}
126
+ end
127
+
128
+ it "with invalid :methods prints error" do
129
+ complete_prints_error(/Invalid.*:method\(s\)/, :methods=>[:blah]) {}
130
+ end
131
+
132
+ it "with invalid :action for method completion prints error" do
133
+ complete_prints_error(/Invalid string :action/, :method=>"blah", :action=>"Kernel#wtf") {}
134
+ end
135
+
136
+ it "with invalid :class prints no error" do
137
+ complete_prints_error(/^$/, :method=>'ok', :class=>/wtf/) {}
138
+ end
139
+
140
+ it "places missions last when declared last" do
141
+ complete(:object=>"Symbol", :place=>:last)
142
+ complete(:on=>/man/, :place=>:last) { }
143
+ complete(:on=>/man\s*(.*)/) {|e| [e.matched[1]] }
144
+ Bond.agent.missions.map {|e| e.class}.should == [Mission, ObjectMission, Mission]
145
+ tab('man ok').should == ['ok']
146
+ end
147
+
148
+ it "places mission correctly for a place number" do
149
+ complete(:object=>"Symbol")
150
+ complete(:on=>/man/) {}
151
+ complete(:on=>/man\s*(.*)/, :place=>1) {|e| [e.matched[1]] }
152
+ tab('man ok')
153
+ Bond.agent.missions.map {|e| e.class}.should == [Mission, ObjectMission, Mission]
154
+ tab('man ok').should == ['ok']
155
+ end
156
+ end
157
+
158
+ describe "recomplete" do
159
+ before {|e| Bond.agent.reset }
160
+
161
+ it "recompletes a mission" do
162
+ complete(:on=>/man/) { %w{1 2 3}}
163
+ Bond.recomplete(:on=>/man/) { %w{4 5 6}}
164
+ tab('man ').should == %w{4 5 6}
165
+ end
166
+
167
+ it "recompletes a mission with :name" do
168
+ complete(:on=>/man/, :name=>:count) { %w{1 2 3}}
169
+ Bond.recomplete(:on=>/man/, :name=>:count) { %w{4 5 6}}
170
+ tab('man ').should == %w{4 5 6}
171
+ end
172
+
173
+ it "recompletes a method mission" do
174
+ complete(:all_methods=>true)
175
+ MethodMission.reset
176
+ complete(:method=>'blah') { %w{1 2 3}}
177
+ Bond.recomplete(:method=>'blah') { %w{4 5 6}}
178
+ tab('blah ').should == %w{4 5 6}
179
+ end
180
+
181
+ it "completes a method mission if mission not found" do
182
+ complete(:all_methods=>true)
183
+ MethodMission.reset
184
+ Bond.recomplete(:method=>'blah') { %w{4 5 6}}
185
+ tab('blah ').should == %w{4 5 6}
186
+ end
187
+
188
+ it "recompletes an object mission" do
189
+ complete(:object=>'String') { %w{1 2 3}}
190
+ Bond.recomplete(:object=>'String') { %w{4 5 6}}
191
+ tab('"blah".').should == %w{.4 .5 .6}
192
+ end
193
+
194
+ it "recompletes anywhere mission" do
195
+ complete(:anywhere=>'dude.*') { %w{duder dudest} }
196
+ Bond.recomplete(:anywhere=>'dude.*') { %w{duderific dudeacious} }
197
+ tab('dude').should == %w{duderific dudeacious}
198
+ end
199
+
200
+ it "prints error if no existing mission" do
201
+ complete(:object=>'String') { %w{1 2 3}}
202
+ capture_stderr { Bond.recomplete(:object=>'Array') { %w{4 5 6}}}.should =~ /No existing mission/
203
+ tab('[].').should == []
204
+ end
205
+
206
+ it "prints error if invalid condition given" do
207
+ capture_stderr { Bond.recomplete}.should =~ /Invalid :action/
208
+ end
209
+ end
210
+
211
+ describe "spy" do
212
+ before_all {
213
+ reset
214
+ complete(:on=>/end$/) { [] };
215
+ complete(:all_methods=>true); complete(:method=>'the') { %w{spy who loved me} }
216
+ complete(:object=>"Symbol")
217
+ }
218
+
219
+ it "detects basic mission" do
220
+ capture_stdout { Bond.spy('the end')}.should =~ /end/
221
+ end
222
+
223
+ it "detects object mission" do
224
+ capture_stdout { Bond.spy(':dude.i')}.should =~ /object.*Symbol.*dude\.id/m
225
+ end
226
+
227
+ it "detects method mission" do
228
+ capture_stdout { Bond.spy('the ')}.should =~ /method.*the.*Kernel.*loved/m
229
+ end
230
+
231
+ it "detects no mission" do
232
+ capture_stdout { Bond.spy('blah')}.should =~ /Doesn't match/
233
+ end
234
+ end
235
+ end
@@ -0,0 +1,34 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "anywhere mission" do
4
+ before { Bond.agent.reset }
5
+
6
+ describe "normally" do
7
+ before { complete(:anywhere=>':[^:\s.]*') {|e| %w{:ab :bd :ae} } }
8
+
9
+ it "completes at beginning" do
10
+ tab(":a").should == %w{:ab :ae}
11
+ end
12
+
13
+ it "completes in middle of string" do
14
+ tab("hash[:a").should == %w{hash[:ab hash[:ae}
15
+ end
16
+
17
+ it "completes after word break chars" do
18
+ tab("{:ab=>1}[:a").should == ["1}[:ab", "1}[:ae"]
19
+ tab("nil;:a").should == %w{:ab :ae}
20
+ end
21
+ end
22
+
23
+ it 'with special chars and custom search completes' do
24
+ complete(:anywhere=>'\$[^\s.]*', :search=>false) {|e|
25
+ global_variables.grep(/^#{Regexp.escape(e.matched[1])}/)
26
+ }
27
+ tab("$LO").sort.should == ["$LOADED_FEATURES", "$LOAD_PATH"]
28
+ end
29
+
30
+ it 'with :prefix completes' do
31
+ complete(:prefix=>'_', :anywhere=>':[^:\s.]*') { %w{:ab :bd :ae} }
32
+ tab("_:a").should == %w{_:ab _:ae}
33
+ end
34
+ end
@@ -0,0 +1,141 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "Bond" do
4
+ describe "start" do
5
+ def start(options={}, &block)
6
+ Bond.start({:readline=>valid_readline}.merge(options), &block)
7
+ end
8
+
9
+ before { M.instance_eval("@started = @agent = @config = nil"); M.expects(:load_completions) }
10
+ it "prints error if readline doesn't have all required methods" do
11
+ capture_stderr {
12
+ start :readline=>Module.new{ def self.setup(arg); end }
13
+ }.should =~ /Invalid/
14
+ end
15
+
16
+ it "prints error if readline symbol is invalid" do
17
+ capture_stderr {
18
+ start :readline => :blah
19
+ }.should =~ /Invalid.*'blah'/
20
+ end
21
+
22
+ it "prints no error if valid readline" do
23
+ capture_stderr { start }.should == ''
24
+ end
25
+
26
+ it 'prints no error if valid readline symbol' do
27
+ capture_stderr { start :readline => :ruby }.should == ''
28
+ Bond.config[:readline].should == Bond::Ruby
29
+ end
30
+
31
+ it "sets default mission" do
32
+ start :default_mission=>lambda {|e| %w{1 2 3}}
33
+ tab('1').should == ['1']
34
+ end
35
+
36
+ it "sets default search" do
37
+ start :default_search=>:anywhere
38
+ complete(:on=>/blah/) { %w{all_quiet on_the western_front}}
39
+ tab('blah qu').should == ["all_quiet"]
40
+ end
41
+
42
+ it "defines completion in block" do
43
+ start { complete(:on=>/blah/) { %w{all_quiet on_the western_front}} }
44
+ tab('blah all').should == ["all_quiet"]
45
+ end
46
+
47
+ it "sets proc eval_binding" do
48
+ bdg = binding
49
+ start :eval_binding => lambda { bdg }
50
+ Mission.expects(:eval).with(anything, bdg).returns([])
51
+ tab("'blah'.").should == []
52
+ end
53
+
54
+ it "status can be checked with started?" do
55
+ Bond.started?.should == false
56
+ start
57
+ Bond.started?.should == true
58
+ end
59
+
60
+ after_all { reset }
61
+ end
62
+
63
+ describe "start with :gems" do
64
+ before {
65
+ File.stubs(:exists?).returns(true)
66
+ M.stubs(:load_file)
67
+ }
68
+
69
+ it "attempts to load gem" do
70
+ M.stubs(:load_dir)
71
+ M.expects(:gem).twice
72
+ start(:gems=>%w{one two})
73
+ end
74
+
75
+ it "rescues nonexistent gem" do
76
+ M.stubs(:load_dir)
77
+ M.expects(:gem).raises(LoadError)
78
+ should.not.raise { start(:gems=>%w{blah}) }
79
+ end
80
+
81
+ it "rescues nonexistent method 'gem'" do
82
+ M.stubs(:load_dir)
83
+ M.expects(:gem).raises(NoMethodError)
84
+ should.not.raise { start(:gems=>%w{blah}) }
85
+ end
86
+
87
+ it "prints error if gem completion not found" do
88
+ M.stubs(:load_dir)
89
+ M.expects(:find_gem_file).returns(nil)
90
+ capture_stderr { start(:gems=>%w{invalid}) }.should =~ /No completions.*'invalid'/
91
+ end
92
+
93
+ it "loads gem completion file" do
94
+ M.expects(:load_dir)
95
+ M.expects(:load_dir).with(File.join($:[0], 'awesome', '..', 'bond'))
96
+ M.expects(:load_dir)
97
+ M.expects(:gem)
98
+ start(:gems=>%w{awesome})
99
+ end
100
+ after_all { reset }
101
+ end
102
+
103
+ it "prints error if Readline setup fails" do
104
+ Bond::Readline.expects(:setup).raises('WTF')
105
+ capture_stderr { Bond.start(:readline=>Bond::Readline) }.should =~ /Error.*Failed Readline.*'WTF'/
106
+ M.debrief :readline=>valid_readline
107
+ end
108
+
109
+ it "start prints error for failed completion file" do
110
+ Rc.stubs(:module_eval).raises('wtf')
111
+ capture_stderr { Bond.start }.should =~ /Bond Error: Completion file.*with:\nwtf/
112
+ end
113
+
114
+ it "reset clears existing missions" do
115
+ complete(:on=>/blah/) {[]}
116
+ Bond.agent.missions.size.should.not == 0
117
+ reset
118
+ Bond.agent.missions.size.should == 0
119
+ end
120
+
121
+ describe "restart" do
122
+ def start(options={}, &block)
123
+ Bond.start({:readline=>valid_readline}.merge(options), &block)
124
+ end
125
+
126
+ it "deletes previous config" do
127
+ start :blah=>''
128
+ Bond.config[:blah].should.not == nil
129
+ Bond.restart({:readline=>valid_readline})
130
+ Bond.config[:blah].should == nil
131
+ end
132
+
133
+ it "deletes previous method completions" do
134
+ start
135
+ complete(:method=>'blah') { [] }
136
+ MethodMission.actions['blah'].should.not == nil
137
+ Bond.restart({:readline=>valid_readline})
138
+ MethodMission.actions['blah'].should == nil
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,148 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe "Completion" do
4
+ before_all {
5
+ reset
6
+ M.load_file File.dirname(__FILE__) + '/../lib/bond/completion.rb'
7
+ M.load_dir File.dirname(__FILE__) + '/../lib/bond'
8
+ }
9
+
10
+ it "completes global variables anywhere" do
11
+ tab("blah $LOA").should.satisfy {|e|
12
+ e.size > 0 && e.all? {|e| e=~ /^\$LOA/} }
13
+ tab("h[$LOADED").should == ["h[$LOADED_FEATURES"]
14
+ end
15
+
16
+ it "completes absolute constants anywhere" do
17
+ tab("blah ::Has").should == ["::Hash"]
18
+ tab("h[::Has").should == ["h[::Hash"]
19
+ end
20
+
21
+ it "completes invalid constants safely" do
22
+ capture_stdout {
23
+ tab("Bond::MethodMission ").should == []
24
+ }.should == ''
25
+ end
26
+
27
+ it "completes nested classes greater than 2 levels" do
28
+ eval %[module ::Foo; module Bar; module Baz; end; end; end]
29
+ tab("Foo::Bar::B").should == %w{Foo::Bar::Baz}
30
+ end
31
+
32
+ it "completes nested classes anywhere" do
33
+ tab("module Blah; include Bond::Sea").should == ["Bond::Search"]
34
+ end
35
+
36
+ it "completes symbols anywhere" do
37
+ Symbol.expects(:all_symbols).twice.returns([:mah])
38
+ tab("blah :m").size.should.be > 0
39
+ tab("blah[:m").should == ["blah[:mah"]
40
+ end
41
+
42
+ it "completes method arguments with parenthesis" do
43
+ tab("%w{ab bc cd}.delete(").should == %w{ab bc cd}
44
+ end
45
+
46
+ it "completes method arguments when object contains method names" do
47
+ tab("%w{find ab cd}.delete ").should == %w{find ab cd}
48
+ end
49
+
50
+ it "completes hash coming from a method" do
51
+ tab('Bond.config[:r').should == ["Bond.config[:readline"]
52
+ end
53
+
54
+ it "methods don't swallow up default completion" do
55
+ Bond.agent.find_mission("some_method(:verbose=>true) { Arr").should == nil
56
+ end
57
+
58
+ describe "completes object methods" do
59
+ def be_methods_from(klass, regex, obj=klass.new)
60
+ lambda {|e|
61
+ meths = e.map {|f| f.sub(/^#{Regexp.quote(regex)}/, '') }
62
+ meths.size.should.be > 0
63
+ (meths - obj.methods.map {|e| e.to_s} - Mission::OPERATORS).size.should == 0
64
+ }
65
+ end
66
+
67
+ shared "objects" do
68
+ it "non whitespace object" do
69
+ tab(':man.').should be_methods_from(Symbol, ':man.', :man)
70
+ end
71
+
72
+ it "nil" do
73
+ tab("nil.t").should be_methods_from(NilClass, 'nil.', nil)
74
+ end
75
+
76
+ it "false" do
77
+ tab("false.f").should be_methods_from(FalseClass, 'false.', false)
78
+ end
79
+
80
+ it "strings" do
81
+ tab("'man oh'.s").should be_methods_from(String, '.')
82
+ tab('"man oh".s').should be_methods_from(String, '.')
83
+ end
84
+
85
+ it "array" do
86
+ tab("[1, 2].f").should be_methods_from(Array, '2].')
87
+ end
88
+
89
+ it "hash" do
90
+ tab("{:a =>1}.f").should be_methods_from(Hash, '1}.')
91
+ end
92
+
93
+ it "regexp" do
94
+ tab("/man oh/.c").should be_methods_from(Regexp, 'oh/.', /man oh/)
95
+ end
96
+
97
+ it "proc" do
98
+ tab('lambda { }.c').should be_methods_from(Proc, '}.', lambda{})
99
+ tab('proc { }.c').should be_methods_from(Proc, '}.', lambda{})
100
+ end
101
+
102
+ it "range" do
103
+ tab("(1 .. 10).m").should be_methods_from(Range, '10).', (1..10))
104
+ end
105
+
106
+ it "object between ()" do
107
+ tab("(2 * 2).").should be_methods_from(Fixnum, '2).', 2)
108
+ tab("String.new('man oh').s").should be_methods_from(String, ').')
109
+ end
110
+
111
+ it "object quoted by {}" do
112
+ tab("%r{man oh}.c").should be_methods_from(Regexp, 'oh}.', /man oh/)
113
+ tab("%q{man oh}.s").should be_methods_from(String, 'oh}.')
114
+ tab("%Q{man oh}.s").should be_methods_from(String, 'oh}.')
115
+ tab("%w{man oh}.f").should be_methods_from(Array, 'oh}.')
116
+ tab("%s{man oh}.t").should be_methods_from(Symbol, 'oh}.', :man)
117
+ tab("%{man oh}.t").should be_methods_from(String, 'oh}.')
118
+ end
119
+
120
+ it "object quoted by []" do
121
+ tab("%r[man oh].c").should be_methods_from(Regexp, 'oh].', /man oh/)
122
+ tab("%q[man oh].s").should be_methods_from(String, 'oh].')
123
+ tab("%Q[man oh].s").should be_methods_from(String, 'oh].')
124
+ tab("%w[man oh].f").should be_methods_from(Array, 'oh].')
125
+ tab("%s[man oh].t").should be_methods_from(Symbol, 'oh].', :man)
126
+ tab("%[man oh].t").should be_methods_from(String, 'oh].')
127
+ end
128
+ end
129
+
130
+ describe "for" do
131
+ behaves_like "objects"
132
+ end
133
+
134
+ describe "after valid ruby for" do
135
+ def tab(str)
136
+ super("nil; "+str)
137
+ end
138
+ behaves_like "objects"
139
+ end
140
+
141
+ describe "after invalid ruby for" do
142
+ def tab(str)
143
+ super("blah "+str)
144
+ end
145
+ behaves_like "objects"
146
+ end
147
+ end
148
+ end