Skip to content

Commit 2e01ae6

Browse files
committed
help should be passed as command option in all cases
fix tests
1 parent 1474ac4 commit 2e01ae6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/PerformMessageCommandLineHandler/PerformMessageCommandLineHandler.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ PerformMessageCommandLineHandler >> printHelp [
128128
{ #category : 'testing' }
129129
PerformMessageCommandLineHandler >> shouldActivateHelp [
130130

131-
^ self commandOptions includes: ('--help')
131+
^ self arguments first = '--help'
132132
]
133133

134134
{ #category : 'testing' }

tests/pharo-cli-perform.bats

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,46 @@ teardown() {
1717
}
1818

1919
@test "perform can perform selector on class and quit" {
20-
run_pharo perform String name
20+
run_pharo perform --pass-raw-arguments -- String name
2121
assert_success
2222
assert_output "#String"
2323
}
2424

2525
@test "perform can perform selector on class with arguments and quit" {
26-
run_pharo perform Array with:with: 1 2
26+
run_pharo perform --pass-raw-arguments -- Array with:with: 1 2
2727
assert_success
2828
assert_output "#('1' '2')"
2929
}
3030

3131
@test "perform outputs error if receiver not found" {
32-
run_pharo perform Foo bar
32+
run_pharo perform --pass-raw-arguments -- Foo bar
3333
assert_failure
3434
assert_output --regexp "[[:blank:]]*Unknown class[[:blank:]]*"
3535
}
3636

3737
@test "perform outputs error if selector not found" {
38-
run_pharo perform String bar
38+
run_pharo perform --pass-raw-arguments -- String bar
3939
assert_failure
4040
assert_line --index 0 --regexp "[[:blank:]]*Instance of String class did not understand #bar[[:blank:]]*"
4141
}
4242

4343
@test "perform does not save if flag --save absent" {
4444
copy_image "test-save.image"
45-
run_pharo perform ClapPharoCommandsTest testValue: Wednesday.
45+
run_pharo perform --pass-raw-arguments -- ClapPharoCommandsTest testValue: Wednesday.
4646
assert_success
4747

48-
run_pharo perform ClapPharoCommandsTest testValue
48+
run_pharo perform --pass-raw-arguments -- ClapPharoCommandsTest testValue
4949
assert_success
5050
refute_output --partial "Wednesday"
5151
}
5252

5353
@test "perform --save preserves changes in the image" {
5454
copy_image "test-save.image"
55-
run_pharo perform --save ClapPharoCommandsTest testValue: Wednesday.
55+
run_pharo perform --save --pass-raw-arguments -- ClapPharoCommandsTest testValue: Wednesday.
5656
assert_success
5757

5858
# Check that the evaluation of the previous script has been persisted
59-
run_pharo perform ClapPharoCommandsTest testValue
59+
run_pharo perform --pass-raw-arguments -- ClapPharoCommandsTest testValue
6060
assert_success
6161
assert_output --partial "Wednesday"
6262
}

0 commit comments

Comments
 (0)