File tree Expand file tree Collapse file tree 4 files changed +17
-14
lines changed Expand file tree Collapse file tree 4 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class CurrentWorkingWorkspace < Base
15
15
description "Show the current workspace."
16
16
17
17
def execute ( _arg )
18
- irb_context . main
18
+ puts "Current workspace: #{ irb_context . main } "
19
19
end
20
20
end
21
21
@@ -30,7 +30,8 @@ def execute(arg)
30
30
obj = eval ( arg , irb_context . workspace . binding )
31
31
irb_context . change_workspace ( obj )
32
32
end
33
- irb_context . main
33
+
34
+ puts "Current workspace: #{ irb_context . main } "
34
35
end
35
36
end
36
37
end
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def execute_internal(*obj)
49
49
50
50
extend_irb_context
51
51
IRB . irb ( nil , *obj )
52
+ puts IRB . JobManager . inspect
52
53
end
53
54
end
54
55
@@ -65,7 +66,7 @@ def execute(_arg)
65
66
end
66
67
67
68
extend_irb_context
68
- IRB . JobManager
69
+ puts IRB . JobManager . inspect
69
70
end
70
71
end
71
72
@@ -90,6 +91,7 @@ def execute_internal(key = nil)
90
91
91
92
raise CommandArgumentError . new ( "Please specify the id of target IRB job (listed in the `jobs` command)." ) unless key
92
93
IRB . JobManager . switch ( key )
94
+ puts IRB . JobManager . inspect
93
95
end
94
96
end
95
97
@@ -112,6 +114,7 @@ def execute_internal(*keys)
112
114
113
115
extend_irb_context
114
116
IRB . JobManager . kill ( *keys )
117
+ puts IRB . JobManager . inspect
115
118
end
116
119
end
117
120
end
Original file line number Diff line number Diff line change @@ -587,18 +587,19 @@ def inspect_mode=(opt)
587
587
588
588
def evaluate ( statement , line_no ) # :nodoc:
589
589
@line_no = line_no
590
- result = nil
591
590
592
591
case statement
593
592
when Statement ::EmptyInput
594
593
return
595
594
when Statement ::Expression
596
595
result = evaluate_expression ( statement . code , line_no )
596
+ set_last_value ( result )
597
597
when Statement ::Command
598
- result = statement . command_class . execute ( self , statement . arg )
598
+ statement . command_class . execute ( self , statement . arg )
599
+ set_last_value ( nil )
599
600
end
600
601
601
- set_last_value ( result )
602
+ nil
602
603
end
603
604
604
605
def evaluate_expression ( code , line_no ) # :nodoc:
Original file line number Diff line number Diff line change @@ -485,12 +485,11 @@ class Foo; end
485
485
class CwwsTest < WorkspaceCommandTestCase
486
486
def test_cwws_returns_the_current_workspace_object
487
487
out , err = execute_lines (
488
- "cwws" ,
489
- "self.class"
488
+ "cwws"
490
489
)
491
490
492
491
assert_empty err
493
- assert_include ( out , self . class . name )
492
+ assert_include ( out , "Current workspace: #{ self } " )
494
493
end
495
494
end
496
495
@@ -556,7 +555,7 @@ def test_popws_replaces_the_current_workspace_with_the_previous_one
556
555
"pushws Foo.new\n " ,
557
556
"popws\n " ,
558
557
"cwws\n " ,
559
- "_ .class" ,
558
+ "self .class" ,
560
559
)
561
560
assert_empty err
562
561
assert_include ( out , "=> #{ self . class } " )
@@ -576,20 +575,19 @@ def test_chws_replaces_the_current_workspace
576
575
out , err = execute_lines (
577
576
"chws #{ self . class } ::Foo.new\n " ,
578
577
"cwws\n " ,
579
- "_ .class" ,
578
+ "self .class\n "
580
579
)
581
580
assert_empty err
581
+ assert_include ( out , "Current workspace: #<#{ self . class . name } ::Foo" )
582
582
assert_include ( out , "=> #{ self . class } ::Foo" )
583
583
end
584
584
585
585
def test_chws_does_nothing_when_receiving_no_argument
586
586
out , err = execute_lines (
587
587
"chws\n " ,
588
- "cwws\n " ,
589
- "_.class" ,
590
588
)
591
589
assert_empty err
592
- assert_include ( out , "=> #{ self . class } " )
590
+ assert_include ( out , "Current workspace: #{ self } " )
593
591
end
594
592
end
595
593
You can’t perform that action at this time.
0 commit comments