X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=examples%2Ftest.ml;h=490401ed5e375807e1d32da78c89952b97893d28;hb=7f82a6f31e40e596a43939ab18d685a8f0b78d7b;hp=99bcfd4538bcc7639dc9c8c8f7c10f677648a1b4;hpb=9e88eacb7d2a8883900fba0c8abedc26c7510d98;p=perl4caml.git diff --git a/examples/test.ml b/examples/test.ml index 99bcfd4..490401e 100644 --- a/examples/test.ml +++ b/examples/test.ml @@ -1,16 +1,14 @@ (* Simple test of the API. * Copyright (C) 2003 Merjis Ltd. - * $Id: test.ml,v 1.3 2003-10-15 16:51:12 rich Exp $ + * $Id: test.ml,v 1.7 2004-11-25 22:16:17 rich Exp $ *) open Printf -(* XXX Hack to workaround some sort of linking bug in OCaml. Without this - * the Perl module isn't initialized and this code crashes. - *) -let f = Pl_Net_Google.may - let () = + (* Perform a full collection - good way to find bugs in initialization code*) + Gc.full_major (); + (* Load "test.pl". *) Perl.eval "require 'examples/test.pl'"; @@ -50,5 +48,10 @@ let () = let sv = Perl.call_method obj "get_foo" [] in printf "TestClass.foo is %d\n" (Perl.int_of_sv sv); flush stdout; - (* Destroy the interpreter. *) - Perl.destroy (Perl.current_interpreter ()) + (* Create an undef value and test it. *) + let undef = Perl.sv_undef () in + printf "sv_is_undef (undef) = %s\n" + (string_of_bool (Perl.sv_is_undef undef)); + + (* Perform a full collection - good way to find GC/allocation bugs. *) + Gc.full_major ()