summaryrefslogtreecommitdiff
path: root/test/optparse
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-02 02:18:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-02 02:18:44 +0000
commitae042f21fb695fc80eb19273fa542e8dad85f19f (patch)
tree6b64fce04b19a8e1531f60a7d3d47c8a9fc97a20 /test/optparse
parent21f2c194bbf781d9228584f3e93f4a93b33f5632 (diff)
use assert_raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/optparse')
-rw-r--r--test/optparse/test_acceptable.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb
index 6ec619e..ee8479c 100644
--- a/test/optparse/test_acceptable.rb
+++ b/test/optparse/test_acceptable.rb
@@ -32,19 +32,19 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--integer 0x3")})
assert_equal(3, @integer)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--integer 0b")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--integer 09")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--integer 0x")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--integer 1234xyz")
end
end
@@ -65,11 +65,11 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--float 1E-2")})
assert_in_epsilon(0.01, @float)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--float 0e")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--float 1.234xyz")
end
end
@@ -87,15 +87,15 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1.2/2.3")})
assert_equal(Rational(12, 23), @numeric)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--numeric 1/")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--numeric 12/34xyz")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--numeric 12x/34yz")
end
end
@@ -107,21 +107,21 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 10")})
assert_equal(10, @decimal_integer)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 0b1")
end
- e = assert_raises(OptionParser::InvalidArgument) do
+ e = assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 09")
end
assert_equal("invalid argument: --decimal-integer 09", e.message)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer x")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 1234xyz")
end
end
@@ -142,19 +142,19 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 011")})
assert_equal(9, @octal_integer)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--octal-integer 09")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--octal-integer 0b1")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--octal-integer x")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--octal-integer 01234xyz")
end
end
@@ -172,21 +172,21 @@ class TestOptionParser::Acceptable < TestOptionParser
assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 1E2")})
assert_in_delta(100.0, @decimal_numeric)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-numeric 0b1")
end
- e = assert_raises(OptionParser::InvalidArgument) do
+ e = assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-numeric 09")
end
assert_equal("invalid argument: --decimal-numeric 09", e.message)
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 1234xyz")
end
- assert_raises(OptionParser::InvalidArgument) do
+ assert_raise(OptionParser::InvalidArgument) do
@opt.parse!(%w"--decimal-integer 12.34xyz")
end
end