]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/test/test.factor
compiler.cfg.*: putting test-init in compiler.cfg.stacks.tests didn't work, put new...
[factor.git] / basis / compiler / test / test.factor
1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays compiler.units kernel sequences
4 stack-checker tools.test vocabs words ;
5 IN: compiler.test
6
7 : decompile ( word -- )
8     dup def>> 2array 1array t t modify-code-heap ;
9
10 : recompile-all ( -- )
11     all-words compile ;
12
13 : compile-call ( quot -- )
14     [ dup infer define-temp ] with-compilation-unit execute ;
15
16 << \ compile-call t "no-compile" set-word-prop >>
17
18 : compiler-test ( name -- )
19     "resource:basis/compiler/tests/" ".factor" surround run-test-file ;
20
21 USING: compiler.cfg.registers compiler.cfg.stacks compiler.cfg.stacks.local
22 fry namespaces ;
23
24 : init-cfg-test ( -- )
25     reset-vreg-counter begin-stack-analysis begin-local-analysis
26     H{ } clone replace-mapping set ;
27
28 : cfg-unit-test ( result quot -- )
29     '[ init-cfg-test @ ] unit-test ; inline