aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 14:57:22 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 14:57:22 +0000
commit20039668ddf425ab3430e06b1021bc86f2f30b4f (patch)
tree35a672b0c6dd5dee11a0728e7b40a2a3ed6bfd84
parent628559765352624df9aff2ff7d73927e0df858de (diff)
downloadruby-20039668ddf425ab3430e06b1021bc86f2f30b4f.tar.gz
* complex.c (make_patterns): should not accept extra sign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--complex.c2
-rw-r--r--test/ruby/test_complex.rb1
3 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ea49b01907..75ee2564be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Nov 17 23:53:05 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (make_patterns): should not accept extra sign.
+
Sat Nov 17 21:45:12 Luis Lavena <luislavena@gmail.com>
* win32/file.c (replace_to_long_name): skip expansion for all wildcard
diff --git a/complex.c b/complex.c
index d04c7d73dd..d515e59061 100644
--- a/complex.c
+++ b/complex.c
@@ -1506,7 +1506,7 @@ static VALUE comp_pat0, comp_pat1, comp_pat2, a_slash, a_dot_and_an_e,
#define NUMBER "[-+]?" NUMERATOR "(?:\\/" DENOMINATOR ")?"
#define NUMBERNOS NUMERATOR "(?:\\/" DENOMINATOR ")?"
#define PATTERN0 "\\A" WS "(" NUMBER ")@(" NUMBER ")" WS
-#define PATTERN1 "\\A" WS "([-+])?(" NUMBER ")?[iIjJ]" WS
+#define PATTERN1 "\\A" WS "([-+])?(" NUMBERNOS ")?[iIjJ]" WS
#define PATTERN2 "\\A" WS "(" NUMBER ")(([-+])(" NUMBERNOS ")?[iIjJ])?" WS
static void
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 332e026f0f..0a7828b85f 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -1154,6 +1154,7 @@ class Complex_Test < Test::Unit::TestCase
assert_equal('-1.0-0.0i', Complex(-1.0, -0.0).to_s)
assert_in_delta(Math::PI, Complex(-0.0).arg, 0.001)
assert_equal(Complex(2e3, 2e4), '2e3+2e4i'.to_c)
+ assert_raise(ArgumentError){ Complex('--8i')}
end
def test_known_bug