[C-prog-lang-l] STEF - A Simple TEst Framework on github

Jan Pechanec jp at devnull.cz
Fri Mar 29 12:58:53 CET 2019


Hi,

I've uploaded to github a simple test framework we use for our own
tests.  It might come in handy when testing your ed implementation.
If you use it, I suggest you write a simple test for any feature you
add to your ed project, as soon as you write it.  That's what could
greatly help in avoding regressions if you run the tests after every
change.

https://github.com/devnull-cz/stef

As ed just reads its input from stdin, you may easily test it 
automatically in a test script, like this:

$ ed << INPUT passwd
1p
0i
First line
.
w
1n
q
INPUT

Then create the output file with the expected output.  There is also 
an example directory of a simple project tests:

https://github.com/devnull-cz/stef/tree/master/example

If you run the stef.sh script on that directory, it will show you how
it works:

$ ./stef.sh example/
=== [ STEF Example Use Case ] ===

001    PASS
002    UNSUPPORTED
== 8< BEGIN output ==
Even for unsupported runs, the output is printed if there is any.
== 8< END output=====
003    UNTESTED
== 8< BEGIN output ==
Even for untested runs, the output is printed if there is any.
== 8< END output=====
004    FAIL
== 8< BEGIN output ==
This is some output the test script printed.
It is printed here as the test failed.
== 8< END output=====
005    PASS
006    FAIL
== 8< BEGIN diff output ==
--- test-output-006.txt    2019-03-29 12:31:08.529816385 +0100
+++ stef-output-file.data    2019-03-29 12:53:32.053305303 +0100
@@ -1,2 +1 @@
-This is an example of a test which returned 0 but its output
-does not match the expected printed output.
+hello
== 8< END diff output=====

============

WARNING: some tests FAILED !!!
WARNING: some tests UNTESTED !!!

-- 
Jan Pechanec <jp (at) devnull (dot) cz>
http://www.devnull.cz


More information about the c-prog-lang-l mailing list