From 20039668ddf425ab3430e06b1021bc86f2f30b4f Mon Sep 17 00:00:00 2001 From: tadf Date: Sat, 17 Nov 2012 14:57:22 +0000 Subject: * 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 --- ChangeLog | 4 ++++ complex.c | 2 +- test/ruby/test_complex.rb | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) 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 + + * complex.c (make_patterns): should not accept extra sign. + Sat Nov 17 21:45:12 Luis Lavena * 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 -- cgit v1.2.3