Skip to content

Commit

Permalink
TESTS: added quick-test/run-all.r which runs all Red and Red-System t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
PeterWAWood committed Mar 21, 2012
1 parent d6aabe5 commit 827ccb8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
13 changes: 10 additions & 3 deletions docs/red-system-quick-test.txt
Expand Up @@ -35,12 +35,10 @@ Quick-Test consists of the following:
run-all.r - a script(s) which runs a set of Red/System tests.
- run-all.r in Red/red-system/tests/ runs the Red/System test suite
- run-all.r in Red/red/tests/ runs the Red test suite
- run-all.r in Red/ will run all the tests*
- run-all.r in Red/ will run all the tests
run-test.r - a script which will run an individual test.
- stored in Red/quick-test/

* to be written

===Directory Structure
Quick-Test uses the following directory structure:

Expand All @@ -49,6 +47,7 @@ Quick-Test uses the following directory structure:
quick-test.r
quick-test.reds
quick-unit-test.r
run-all.r ;; runs combined Red & Red/System tests
run-test.r ;; runs an individual test
red/
tests/
Expand All @@ -73,6 +72,14 @@ The tests are designed to be run from the command line or a REBOL console sessio

The following examples assume that they have been run from the Red dir

To run all Red & Red/System tests from the console:

rebol -s quick-test/run-all.r

To run all Red tests from the REBOL console:

do %quick-test/run-all.r

To run all Red tests from the console:

rebol -s red/tests/run-all.r
Expand Down
6 changes: 3 additions & 3 deletions quick-test/quick-test.r
Expand Up @@ -2,7 +2,7 @@ REBOL [
Title: "Simple testing framework for Red/System programs"
Author: "Peter W A Wood"
File: %quick-test.r
Version: 0.8.1
Version: 0.8.2
Rights: "Copyright (C) 2011 Peter W A Wood. All rights reserved."
License: "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]
Expand Down Expand Up @@ -274,13 +274,14 @@ qt: make object! [
reds-file?: false
test-name: find/last/tail src "/"
test-name: copy/part test-name find test-name "."
print [ "running " test-name #"^(0D)"]
prin [ "running " test-name #"^(0D)"]
clear output
cmd: join to-local-file system/options/boot [" -sc " tests-dir src]
call/output/wait cmd output
add-to-run-totals
write/append log-file output
file/title: test-name
replace file/title "-test" ""
_print-summary file
]

Expand All @@ -296,7 +297,6 @@ qt: make object! [
do script
]

;; This is for quick-unit-test.r (in REBOL)
run-script-quiet: func [src [file!]][
prin [ "running " find/last/tail src "/" #"^(0D)"]
print: :_quiet-print
Expand Down
46 changes: 46 additions & 0 deletions quick-test/run-all.r
@@ -0,0 +1,46 @@
REBOL [
Title: "Builds and Runs All Red and Red/System Tests"
File: %run-all.r
Author: "Peter W A Wood"
Version: 0.1.0
License: "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]
;; function to find and run-tests
run: func [dir [file!]][
qt/tests-dir: dir
foreach line read/lines dir/run-all.r [
if any [
find line "===start-group"
find line "--run-"
][
do line
]
]
]

;; supress script messages
store-quiet-mode: system/options/quiet
system/options/quiet: true

do %quick-test.r

;; run the tests
print rejoin ["Quick-Test v" system/script/header/version]
print rejoin ["REBOL " system/version]

start-time: now/precise

***start-run-quiet*** "Complete Red Test Suite"

run %../red/tests/
run %../red-system/tests/

***end-run-quiet***

end-time: now/precise
print [" in" difference end-time start-time newline]
system/options/quiet: store-quiet-mode
ask "hit enter to finish"
print ""


0 comments on commit 827ccb8

Please sign in to comment.