@@ -8,7 +8,7 @@ function setUp()
88 unset ruby_cache_dir
99}
1010
11- function test_parse_ruby_with_a_single_name ()
11+ function test_parse_ruby_with_a_single_ruby_name ()
1212{
1313 local expected_ruby=" jruby"
1414
@@ -18,7 +18,7 @@ function test_parse_ruby_with_a_single_name()
1818 assertEquals " did not set \$ ruby" " $expected_ruby " " $ruby "
1919}
2020
21- function test_parse_ruby_with_a_name_dash_version ()
21+ function test_parse_ruby_with_a_ruby_name_dash_version ()
2222{
2323 local expected_ruby=" jruby"
2424 local expected_version=" 9.0.0"
@@ -43,7 +43,32 @@ function test_parse_ruby_with_just_a_version()
4343 " $ruby_version "
4444}
4545
46- function test_parse_ruby_when_the_ruby_name_contains_multiple_dashes()
46+ function test_parse_ruby_with_just_a_version_that_contains_a_dash()
47+ {
48+ local expected_version=" 4.0.0-rc1"
49+
50+ parse_ruby " $expected_version "
51+
52+ assertEquals " did not return successfully" 0 $?
53+ assertEquals " did not set \$ ruby to ruby" " $ruby " " ruby"
54+ assertEquals " did not set \$ ruby_version" " $expected_version " \
55+ " $ruby_version "
56+ }
57+
58+ function test_parse_ruby_with_just_a_ruby_name_that_contains_a_dash()
59+ {
60+ local expected_ruby=" truffleruby-graalvm"
61+ local expected_version=" "
62+
63+ parse_ruby " $expected_ruby "
64+
65+ assertEquals " did not return successfully" 0 $?
66+ assertEquals " did not set \$ ruby" " $ruby " " $expected_ruby "
67+ assertEquals " did not set \$ ruby_version" " $expected_version " \
68+ " $ruby_version "
69+ }
70+
71+ function test_parse_ruby_with_a_ruby_name_and_version_but_the_ruby_name_contains_a_dash()
4772{
4873 local expected_ruby=" truffleruby-graalvm"
4974 local expected_version=" 1.2.3"
@@ -56,6 +81,19 @@ function test_parse_ruby_when_the_ruby_name_contains_multiple_dashes()
5681 " $ruby_version "
5782}
5883
84+ function test_parse_ruby_when_the_ruby_name_and_version_both_contain_dashes()
85+ {
86+ local expected_ruby=" truffleruby-graalvm"
87+ local expected_version=" 1.2.3-preview1"
88+
89+ parse_ruby " $expected_ruby -$expected_version "
90+
91+ assertEquals " did not return successfully" 0 $?
92+ assertEquals " did not match the ruby name" " $expected_ruby " " $ruby "
93+ assertEquals " did not match the ruby version" " $expected_version " \
94+ " $ruby_version "
95+ }
96+
5997function test_parse_ruby_with_an_unknown_ruby()
6098{
6199 local unknown_ruby=" foo"
0 commit comments