Skip to content

Commit

Permalink
Test custom messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nomennescio committed Aug 2, 2019
1 parent 5bb1972 commit 61c244f
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/test-custom.4th
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
\ Copyright 2019 nomennescio

s" custom messages" describe#{

:noname ." Just passed" cr ; ^passed !
:noname ." Just failed" cr ; ^different !

s" short strings" it#{
<{ s" Hello World!" s# -> s" Hello World!" s# }>
<{ s" Hello Worlds!" s# -> s" Hello Worlds!" s# }>
}#
s" failing compares" it#{
<{ s" Hello World!" s# -> s" Hello Worlds!" s# }>
<{ s" Hello Worlds!" s# -> s" Hello Worlds! " s# }>
}#

2variable actual$
2variable expected$

:noname ." Got '" actual$ 2@ type ." ' as expected" cr ; ^passed !
:noname ." Expected '" expected$ 2@ type ." ', got '" actual$ 2@ type ." '" cr ; ^different !

: &actual 2dup actual$ 2! ;
: &expected 2dup expected$ 2! ;

s" short strings" it#{
<{ s" Hello World!" &actual s# -> s" Hello World!" &expected s# }>
<{ s" Hello Worlds!" &actual s# -> s" Hello Worlds!" &expected s# }>
}#
s" failing compares" it#{
<{ s" Hello World!" &actual s# -> s" Hello Worlds!" &expected s# }>
<{ s" Hello Worlds!" &actual s# -> s" Hello Worlds! " &expected s# }>
}#

}#
36 changes: 36 additions & 0 deletions test/test-custom.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

<DESCRIBE::>custom messages

<IT::>short strings

<PASSED::>Just passed

<PASSED::>Just passed

<COMPLETEDIN::>0.139 ms

<IT::>failing compares

<FAILED::>Just failed

<FAILED::>Just failed

<COMPLETEDIN::>0.162 ms

<IT::>short strings

<PASSED::>Got 'Hello World!' as expected

<PASSED::>Got 'Hello Worlds!' as expected

<COMPLETEDIN::>0.149 ms

<IT::>failing compares

<FAILED::>Expected 'Hello Worlds!', got 'Hello World!'

<FAILED::>Expected 'Hello Worlds! ', got 'Hello Worlds!'

<COMPLETEDIN::>0.150 ms

<COMPLETEDIN::>1.365 ms

0 comments on commit 61c244f

Please sign in to comment.