mason.report: fix timings-table, and add unit tests

db4
Slava Pestov 2009-04-20 03:29:16 -05:00
parent a4d48a1cd4
commit dff8f80ea6
23 changed files with 59 additions and 11 deletions

View File

@ -0,0 +1 @@
Benchmarks

View File

@ -0,0 +1 @@
{ "benchmarks" }

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1 @@
H{ { "a" 1 } { "b" 2 } }

View File

@ -0,0 +1,2 @@
Boot
Log

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1,2 @@
Compile
Log

View File

@ -0,0 +1 @@
Compiler errors

View File

@ -0,0 +1 @@
{ "compiler-errors" }

View File

@ -0,0 +1 @@
"deadbeef"

View File

@ -0,0 +1 @@
Help lint

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1 @@
{ "help-lint" }

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1 @@
Load everything

View File

@ -0,0 +1 @@
{ "load-everything" }

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1 @@
Test all errors

View File

@ -0,0 +1 @@
{ "test-all" }

View File

@ -0,0 +1,2 @@
Test
Log

View File

@ -0,0 +1 @@
1234

View File

@ -1,4 +1,28 @@
IN: mason.report.tests IN: mason.report.tests
USING: mason.report tools.test ; USING: io.files io.directories kernel mason.report mason.common
tools.test xml xml.writer ;
{ 0 0 } [ [ ] with-report ] must-infer-as { 0 0 } [ [ ] with-report ] must-infer-as
: verify-report ( -- )
[ t ] [ "report" exists? ] unit-test
[ ] [ "report" file>xml drop ] unit-test
[ ] [ "report" delete-file ] unit-test ;
"resource:extra/mason/report/fake-data/" [
[ ] [
timings-table pprint-xml
] unit-test
[ ] [ successful-report ] unit-test
verify-report
[ status-error ] [ 1234 compile-failed ] unit-test
verify-report
[ status-error ] [ 1235 boot-failed ] unit-test
verify-report
[ status-error ] [ 1236 test-failed ] unit-test
verify-report
] with-directory

View File

@ -3,7 +3,8 @@
USING: benchmark combinators.smart debugger fry io assocs USING: benchmark combinators.smart debugger fry io assocs
io.encodings.utf8 io.files io.sockets io.streams.string kernel io.encodings.utf8 io.files io.sockets io.streams.string kernel
locals mason.common mason.config mason.platform math namespaces locals mason.common mason.config mason.platform math namespaces
prettyprint sequences xml.syntax xml.writer combinators.short-circuit ; prettyprint sequences xml.syntax xml.writer combinators.short-circuit
literals ;
IN: mason.report IN: mason.report
: common-report ( -- xml ) : common-report ( -- xml )
@ -56,15 +57,14 @@ IN: mason.report
: timings-table ( -- xml ) : timings-table ( -- xml )
{ {
boot-time-file $ boot-time-file
load-time-file $ load-time-file
test-time-file $ test-time-file
help-lint-time-file $ help-lint-time-file
benchmark-time-file $ benchmark-time-file
html-help-time-file $ html-help-time-file
} [ } [
execute( -- string ) dup eval-file milli-seconds>time
dup utf8 file-contents milli-seconds>time
[XML <tr><td><-></td><td><-></td></tr> XML] [XML <tr><td><-></td><td><-></td></tr> XML]
] map [XML <h2>Timings</h2> <table><-></table> XML] ; ] map [XML <h2>Timings</h2> <table><-></table> XML] ;