Documentation updates
parent
eface15ffa
commit
6c5fbd3197
|
@ -76,9 +76,11 @@ $nl
|
|||
{ $code "." }
|
||||
"What we just did is called " { $emphasis "interactive testing" } ". A more advanced technique which comes into play with larger programs is " { $link "tools.test" } "."
|
||||
$nl
|
||||
"Open the file named " { $snippet "palindrome-tests.factor" } "; it is located in the same directory as " { $snippet "palindrome.factor" } ", and it was created by the scaffold tool."
|
||||
"Create a test harness file using the scaffold tool:"
|
||||
{ $code "\"palindrome\" scaffold-tests" }
|
||||
"Now, open the file named " { $snippet "palindrome-tests.factor" } "; it is located in the same directory as " { $snippet "palindrome.factor" } ", and it was created by the scaffold tool."
|
||||
$nl
|
||||
"We will add some unit tests, which are similar to the interactive tests we did above. Unit tests are defined with the " { $link unit-test } " word, which takes a sequence of expected outputs, and a piece of code. It runs the code, and asserts that it outputs the expected values."
|
||||
"We will add some unit tests, which are similar to the interactive tests we did above. Unit tests are defined with the " { $link POSTPONE: unit-test } " word, which takes a sequence of expected outputs, and a piece of code. It runs the code, and asserts that it outputs the expected values."
|
||||
$nl
|
||||
"Add the following three lines to " { $snippet "palindrome-tests.factor" } ":"
|
||||
{ $code
|
||||
|
|
|
@ -42,6 +42,7 @@ $nl
|
|||
ABOUT: "tools.test"
|
||||
|
||||
HELP: unit-test
|
||||
{ $syntax "[ output ] [ input ] unit-test" }
|
||||
{ $values { "output" "a sequence of expected stack elements" } { "input" "a quotation run with an empty stack" } }
|
||||
{ $description "Runs a quotation with an empty stack, comparing the resulting stack with " { $snippet "output" } ". Elements are compared using " { $link = } ". Throws an error if the expected stack does not match the resulting stack." } ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue