Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ <h3>Install</h3>
<h3>Write</h3>

<pre><code class="io">doFile(System ioPath .. "/willful.io")
doFile(System ioPath .. "/ansio.io") # if you want command line colours on *nix (https://github.com/JoshCheek/ansio)
Foo := Object clone do( bar := method("bar"))

describe("Foo") do(
Expand Down
15 changes: 13 additions & 2 deletions willful
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ filter := false
filterKey := nil
filterVal := nil

# set colours if they are not already set
# this allows users to load a lib that defines fgGreen and fgRed on Sequence
# that is appropriate for their system (ie with aniso for *nix)
if(Sequence slotNames contains("fgGreen") not,
Sequence fgGreen := method(self)
)
if(Sequence slotNames contains("fgRed") not,
Sequence fgRed := method(self)
)


getTests := method(dir,
tests = List clone
dir fileNames foreach(file, if(file findSeq("-test"), tests append(dir path .. "/" .. file)))
Expand All @@ -21,9 +32,9 @@ runTests := method(tests,
if(shouldFilter == false or test hasTestsForFilter(filterKey, filterVal),
writeln("\n - Testing " .. test description)
" " print
results := test run(block(passed, if(passed, "." print, "f" print)), filterKey, filterVal, overrideFilter)
results := test run(block(passed, if(passed, "." fgGreen print, "f" fgRed print)), filterKey, filterVal, overrideFilter)
writeln(" " .. results at("passed") .. "/" .. results at("total") .. " Passed")
results at("errors") foreach(error, writeln(" " .. error))
results at("errors") foreach(error, writeln(" " .. error fgRed))
)
)
)
Expand Down