test/test_getopt_long.rb in getopt-1.4.1 vs test/test_getopt_long.rb in getopt-1.4.2
- old
+ new
@@ -2,24 +2,21 @@
# tc_getopt_long.rb
#
# Test suite for the getopt-long package. You should run this test
# via the 'rake test' rake task.
#####################################################################
-require 'rubygems'
-gem 'test-unit'
-
-require 'test/unit'
+require 'test-unit'
require 'getopt/long'
include Getopt
class TC_Getopt_Long < Test::Unit::TestCase
def setup
@opts = nil
end
def test_version
- assert_equal('1.4.1', Long::VERSION)
+ assert_equal('1.4.2', Long::VERSION)
end
def test_constants
assert_not_nil(BOOLEAN)
assert_not_nil(OPTIONAL)
@@ -57,11 +54,11 @@
assert_equal("hello", @opts["foo"])
assert_equal("hello", @opts["f"])
assert_equal("world", @opts["bar"])
assert_equal("world", @opts["b"])
end
-
+
def test_getopts_long_embedded_hyphens
ARGV.push('--foo-bar', 'hello', '--test1-test2-test3', 'world')
assert_nothing_raised{
@opts = Long.getopts(
['--foo-bar', '-f', REQUIRED],
@@ -71,11 +68,11 @@
assert_equal('hello', @opts['foo-bar'])
assert_equal('hello', @opts['f'])
assert_equal('world', @opts['test1-test2-test3'])
assert_equal('world', @opts['t'])
end
-
+
def test_getopts_long_embedded_hyphens_using_equals_sign
ARGV.push('--foo-bar=hello', '--test1-test2-test3=world')
assert_nothing_raised{
@opts = Long.getopts(
['--foo-bar', '-f', REQUIRED],
@@ -243,17 +240,17 @@
},
@opts
)
}
end
-
+
def test_multiple_similar_long_switches_with_no_short_switches
ARGV.push('--to','1','--too','2','--tooo','3')
assert_nothing_raised{
@opts = Long.getopts(
["--to", REQUIRED],
["--too", REQUIRED],
- ["--tooo", REQUIRED]
+ ["--tooo", REQUIRED]
)
}
assert_equal('1', @opts['to'])
assert_equal('2', @opts['too'])
assert_equal('3', @opts['tooo'])