From ef8bd93ae85b153c7b27d323b9fe43f84628cf88 Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Fri, 29 Aug 2008 17:53:00 -0500 Subject: [PATCH] Add a test --- basis/compiler/tests/redefine5.factor | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 basis/compiler/tests/redefine5.factor diff --git a/basis/compiler/tests/redefine5.factor b/basis/compiler/tests/redefine5.factor new file mode 100644 index 0000000000..ac1619b857 --- /dev/null +++ b/basis/compiler/tests/redefine5.factor @@ -0,0 +1,32 @@ +USING: eval tools.test compiler.units vocabs multiline words +kernel ; +IN: compiler.tests + +! Regression: if dispatch was eliminated but method was not inlined, +! compiled usage information was not recorded. + +[ "compiler.tests.redefine5" forget-vocab ] with-compilation-unit + +[ ] [ + <" + USING: sorting kernel math.order ; + IN: compiler.tests.redefine5 + GENERIC: my-generic ( a -- b ) + M: object my-generic [ <=> ] sort ; + : my-inline ( a -- b ) my-generic ; + "> eval +] unit-test + +[ ] [ + <" + USE: kernel + IN: compiler.tests.redefine5 + TUPLE: my-tuple ; + M: my-tuple my-generic drop 0 ; + "> eval +] unit-test + +[ 0 ] [ + "my-tuple" "compiler.tests.redefine5" lookup boa + "my-inline" "compiler.tests.redefine5" lookup execute +] unit-test