PR#6649, GPR#222: accept (int_of_string "+3")

(Christopher McAlpine)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16308 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Gabriel Scherer 2015-08-02 13:32:44 +00:00
parent 60314e38c5
commit 370677b639
4 changed files with 11 additions and 2 deletions

View File

@ -67,6 +67,8 @@ Standard library:
- PR#6577: improve performance of %L, %l, %n, %S, %C format specifiers
(Alain Frisch)
- PR#6585: fix memory leak in win32unix/createprocess.c
- PR#6649, GPR#222: accept (int_of_string "+3")
(Christopher McAlpine)
- PR#6645, GPR#174: Guarantee that Set.add, Set.remove, Set.filter
return the original set if no change is required (Alain Frisch,
Mohamed Iguernelala)

View File

@ -30,7 +30,8 @@ static char * parse_sign_and_base(char * p,
if (*p == '-') {
*sign = -1;
p++;
}
} else if (*p == '+')
p++;
*base = 10; *signedness = 1;
if (*p == '0') {
switch (p[1]) {

View File

@ -382,7 +382,7 @@ failwith_test 5 big_int_of_string "sdjdkfighdgf"
test 6
eq_big_int (big_int_of_string "123", big_int_of_int 123);;
test 7
eq_big_int (big_int_of_string "3456", big_int_of_int 3456);;
eq_big_int (big_int_of_string "+3456", big_int_of_int 3456);;
test 9
eq_big_int (big_int_of_string "-3456", big_int_of_int (-3456));;

View File

@ -1,5 +1,11 @@
open Lib;;
if Pervasives.int_of_string "123" <> 123 then raise Not_found;;
(** test for fix of bug 6649: http://caml.inria.fr/mantis/view.php?id=6649 *)
if Pervasives.int_of_string "+123" <> 123 then raise Not_found;;
if Int32.of_string "+123" <> Int32.of_int 123 then raise Not_found;;
if Int64.of_string "+123" <> Int64.of_int 123 then raise Not_found;;
if Nativeint.of_string "+123" <> Nativeint.of_int 123 then raise Not_found;;
(**
0 CONSTINT 42