From 01767409702f76c9267a301560da27f51970b425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Thu, 12 Jul 2001 16:56:04 -0700 Subject: [PATCH] added a tricy encode_value/decode_value test Rev: src/testsuite.in:1.444 --- src/testsuite.in | 50 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/testsuite.in b/src/testsuite.in index f86fb7bd6a..f7cf8a7edb 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.443 2001/07/12 15:07:35 mast Exp $"]]); +test_true([["$Id: testsuite.in,v 1.444 2001/07/12 23:56:04 hubbe Exp $"]]); cond([[all_constants()->_verify_internals]], [[ @@ -1789,6 +1789,54 @@ test_equal(encode_value_canonic ((<"en","sv","de">)), test_equal(encode_value_canonic ((<"en","sv","de">)), encode_value_canonic ((<"sv","en","de">))) + +test_any([[ +class Test +{ + class Resolver (array c) + { + mixed resolv (string id) + { + if (id == "c") return c; + } + } + + class Codec + { + mixed fooof (string name) {return all_constants()[name];} + function objectof = fooof; + function functionof = fooof; + function programof = fooof; + + string nameof (mixed what) + { + if (string name = search (all_constants(), what)) return name; + return ([])[0]; + } + } + + mixed main() + { + array c = ({"subres"}); + object o = compile ( + #"string res() {return `+(@c());} + string subres() {return \"foo\";}", + Resolver (c))(); + for (int i = 0; i < sizeof (c); i++) + if (stringp (c[i])) c[i] = o[c[i] ]; +#ifdef DEBUG +#define D ,1 +#else +#define D +#endif + function e=encode_value; + function d=decode_value; + return d (e (o, Codec() D), Codec() D)->res(); + } +}; + return Test()->main(); +]],"foo") + test_any([[mixed s="foo"; return s++;]],"foo") test_any([[mixed s="foo"; s++; return s;]],"foo1") test_any([[mixed s="foo"; return ++s;]],"foo1") -- GitLab