* 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
This commit is contained in:
tadf 2012-11-17 14:57:22 +00:00
parent 6285597653
commit 20039668dd
3 changed files with 6 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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