Created a little Test::More-like library for TAP testing
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include "termkey.h"
|
||||
#include "taplib.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TermKey *tk;
|
||||
|
||||
printf("1..2\n");
|
||||
plan_tests(2);
|
||||
|
||||
tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS);
|
||||
|
||||
printf(tk ? "" : "not ");
|
||||
printf("ok 1 - termkey_new\n");
|
||||
ok(!!tk, "termkey_new");
|
||||
|
||||
termkey_destroy(tk);
|
||||
|
||||
printf("ok 2 - termkey_free\n");
|
||||
ok(1, "termkey_free");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
23
t/taplib.c
Normal file
23
t/taplib.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "taplib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static int nexttest = 1;
|
||||
static int _exit_status = 0;
|
||||
|
||||
void plan_tests(int n)
|
||||
{
|
||||
printf("1..%d\n", n);
|
||||
}
|
||||
|
||||
void ok(int cmp, char *name)
|
||||
{
|
||||
printf("%s %d - %s\n", cmp ? "ok" : "not ok", nexttest++, name);
|
||||
if(!cmp)
|
||||
_exit_status = 1;
|
||||
}
|
||||
|
||||
int exit_status(void)
|
||||
{
|
||||
return _exit_status;
|
||||
}
|
||||
3
t/taplib.h
Normal file
3
t/taplib.h
Normal file
@@ -0,0 +1,3 @@
|
||||
void plan_tests(int n);
|
||||
void ok(int cmp, char *name);
|
||||
int exit_status(void);
|
||||
Reference in New Issue
Block a user