aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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