]> gitweb.factorcode.org Git - factor.git/blob - extra/mason/test/test.factor
b23ad19e5e7d9836eaf9da261751c0e86fb56256
[factor.git] / extra / mason / test / test.factor
1 ! Copyright (C) 2008 Eduardo Cavazos, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel namespaces assocs io.files io.encodings.utf8
4 prettyprint help.lint benchmark tools.time bootstrap.stage2
5 tools.test tools.vocabs help.html mason.common words generic
6 accessors compiler.errors sequences sets sorting math ;
7 IN: mason.test
8
9 : do-load ( -- )
10     try-everything
11     [ keys load-everything-vocabs-file to-file ]
12     [ load-everything-errors-file utf8 [ load-failures. ] with-file-writer ]
13     bi ;
14
15 GENERIC: word-vocabulary ( word -- vocabulary )
16
17 M: word word-vocabulary vocabulary>> ;
18
19 M: method-body word-vocabulary "method-generic" word-prop word-vocabulary ;
20
21 : do-compile-errors ( -- )
22     compiler-errors-file utf8 [
23         +error+ errors-of-type keys
24         [ word-vocabulary ] map
25         prune natural-sort .
26     ] with-file-writer ;
27
28 : do-tests ( -- )
29     run-all-tests
30     [ keys test-all-vocabs-file to-file ]
31     [ test-all-errors-file utf8 [ test-failures. ] with-file-writer ]
32     bi ;
33
34 : do-help-lint ( -- )
35     "" run-help-lint
36     [ keys help-lint-vocabs-file to-file ]
37     [ help-lint-errors-file utf8 [ typos. ] with-file-writer ]
38     bi ;
39
40 : do-benchmarks ( -- )
41     run-benchmarks benchmarks-file to-file ;
42
43 : benchmark-ms ( quot -- ms )
44     benchmark 1000 /i ; inline
45
46 : do-all ( -- )
47     ".." [
48         bootstrap-time get boot-time-file to-file
49         [ do-load do-compile-errors ] benchmark-ms load-time-file to-file
50         [ generate-help ] benchmark-ms html-help-time-file to-file
51         [ do-tests ] benchmark-ms test-time-file to-file
52         [ do-help-lint ] benchmark-ms help-lint-time-file to-file
53         [ do-benchmarks ] benchmark-ms benchmark-time-file to-file
54     ] with-directory ;
55
56 MAIN: do-all