gildor478 / ocaml-gettext

Other
13 stars 10 forks source link

String of ocaml string #5

Closed rwmjones closed 5 years ago

rwmjones commented 5 years ago

I copied the function string_of_ocaml_string verbatim from the old code over to the new code. However when testing against our whole corpus I found one place where this function throws an exception, and after further investigation I believe this conversion is not necessary at all.

After applying this patch there is no difference between the *.pot file generated by libguestfs with old and new ocaml-gettext.

rwmjones commented 5 years ago

The test output with this patch seems to be the same as before:

Version         : ocaml-gettext 0.3.7
OS              : Unix
Running tests ...
.......................................................................................................................................................................................FFFFFF........FFFFF
==============================================================================
Failure: Test ocaml-gettext:11:Compile OCaml code:6:invalid_format5.ml

error output of ocamlc -c -I ../libgettext-ocaml/ -I ../libgettext-stub-ocaml/ TestGettext.ml invalid_format5.ml
expected: "File \"invalid_format5.ml\", line 5, characters 29-45:\nError: This expression has type (int64 -> 'a, 'b, 'c, 'd, 'd, 'a) format6\n       but an expression was expected of type\n         (int -> 'e, 'f, 'g, 'g, 'g, 'e) format6\n"
but got: "File \"invalid_format5.ml\", line 5, characters 29-45:\n5 |   eprintf (fn_ \"%d category\" \"%Ld categories\" 1) 1\n                                 ^^^^^^^^^^^^^^^^\nError: This expression has type\n         (int -> 'a, int -> 'a) CamlinternalFormatBasics.precision\n       but an expression was expected of type\n         (int -> 'a, int64 -> 'b) CamlinternalFormatBasics.precision\n       Type int is not compatible with type int64 \n"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:11:Compile OCaml code:5:invalid_format4.ml

error output of ocamlc -c -I ../libgettext-ocaml/ -I ../libgettext-stub-ocaml/ TestGettext.ml invalid_format4.ml
expected: "File \"invalid_format4.ml\", line 5, characters 20-21:\nError: This expression has type int but an expression was expected of type\n         bool\n"
but got: "File \"invalid_format4.ml\", line 5, characters 20-21:\n5 |   eprintf (f_ \"%b\") 2\n                        ^\nError: This expression has type int but an expression was expected of type\n         bool\n"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:11:Compile OCaml code:4:invalid_format3.ml

error output of ocamlc -c -I ../libgettext-ocaml/ -I ../libgettext-stub-ocaml/ TestGettext.ml invalid_format3.ml
expected: "File \"invalid_format3.ml\", line 5, characters 20-21:\nError: This expression has type int but an expression was expected of type\n         string\n"
but got: "File \"invalid_format3.ml\", line 5, characters 20-21:\n5 |   eprintf (f_ \"%s\") 2\n                        ^\nError: This expression has type int but an expression was expected of type\n         string\n"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:11:Compile OCaml code:3:invalid_format2.ml

error output of ocamlc -c -I ../libgettext-ocaml/ -I ../libgettext-stub-ocaml/ TestGettext.ml invalid_format2.ml
expected: "File \"invalid_format2.ml\", line 5, characters 21-22:\nError: This expression has type int but an expression was expected of type\n         int64\n"
but got: "File \"invalid_format2.ml\", line 5, characters 21-22:\n5 |   eprintf (f_ \"%Ld\") 2\n                         ^\nError: This expression has type int but an expression was expected of type\n         int64\n"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:11:Compile OCaml code:2:invalid_format1.ml

error output of ocamlc -c -I ../libgettext-ocaml/ -I ../libgettext-stub-ocaml/ TestGettext.ml invalid_format1.ml
expected: "File \"invalid_format1.ml\", line 5, characters 21-22:\nError: This expression has type int but an expression was expected of type\n         int32\n"
but got: "File \"invalid_format1.ml\", line 5, characters 21-22:\n5 |   eprintf (f_ \"%ld\") 2\n                         ^\nError: This expression has type int but an expression was expected of type\n         int32\n"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:5:fr_FR/LC_MESSAGES/test11.mo

All values should be identical in [ (Camomile.Map,"h\195\169") ; (Camomile.Hashtbl,"h\195\169") ; (Camomile.Open,"h\195\169") ; (Stub.Native,"hey") ; (Stub.Preload,"hey") ] in function GettextCompat.gettext t' "hey"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:4:fr_FR/LC_MESSAGES/test10.mo

All values should be identical in [ (Camomile.Map,"h\195\169") ; (Camomile.Hashtbl,"h\195\169") ; (Camomile.Open,"h\195\169") ; (Stub.Native,"hey") ; (Stub.Preload,"hey") ] in function GettextCompat.gettext t' "hey"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:3:fr_FR/LC_MESSAGES/test4.mo

All values should be identical in [ (Camomile.Map,"Fonction simple sn_ ( singulier )") ; (Camomile.Hashtbl,"Fonction simple sn_ ( singulier )") ; (Camomile.Open,"Fonction simple sn_ ( singulier )") ; (Stub.Native,"sn_ plural") ; (Stub.Preload,"sn_ plural") ] in function GettextCompat.ngettext t' "sn_ singular" "sn_ plural" 0
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:2:fr_FR/LC_MESSAGES/test3.mo

All values should be identical in [ (Camomile.Map,"Content-Type: text/plain; charset=ISO-8859-1\nPlural-Forms: nplurals=2; plural=(n > 1);\n") ; (Camomile.Hashtbl,"Content-Type: text/plain; charset=ISO-8859-1\nPlural-Forms: nplurals=2; plural=(n > 1);\n") ; (Camomile.Open,"Content-Type: text/plain; charset=ISO-8859-1\nPlural-Forms: nplurals=2; plural=(n > 1);\n") ; (Stub.Native,"") ; (Stub.Preload,"") ] in function GettextCompat.gettext t' ""
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:1:fr_FR/LC_MESSAGES/test2.mo

All values should be identical in [ (Camomile.Map,"h\195\169") ; (Camomile.Hashtbl,"h\195\169") ; (Camomile.Open,"h\195\169") ; (Stub.Native,"hey") ; (Stub.Preload,"hey") ] in function GettextCompat.gettext t' "hey"
------------------------------------------------------------------------------
==============================================================================
Failure: Test ocaml-gettext:6:Gettext implementation test:1:Cross check:0:fr_FR/LC_MESSAGES/test1.mo

All values should be identical in [ (Camomile.Map,"h\195\169") ; (Camomile.Hashtbl,"h\195\169") ; (Camomile.Open,"h\195\169") ; (Stub.Native,"hey") ; (Stub.Preload,"hey") ] in function GettextCompat.gettext t' "hey"
------------------------------------------------------------------------------
Ran: 202 tests in: 0.30 seconds.
FAILED: Cases: 202 Tried: 202 Errors: 0 Failures: 11 Skip:  0 Todo: 0 Timeouts: 0.