From 935d293383bbadde9d8c3adaa2081e14a885472b Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Wed, 29 Jul 2015 10:08:03 -0400 Subject: Add a simple 'make test' target --- Makefile.am | 16 +++++++++++++++- tests/crud1.html | 38 ++++++++++++++++++++++++++++++++++++++ tests/hello.html | 10 ++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/crud1.html create mode 100644 tests/hello.html diff --git a/Makefile.am b/Makefile.am index 11f9a132..79cd2e7d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ all-local: smlnj mlton SUBDIRS = src/c -.PHONY: smlnj mlton package reauto +.PHONY: smlnj mlton package reauto test smlnj: src/urweb.cm xml/entities.sml mlton: bin/urweb @@ -114,3 +114,17 @@ reauto: EXTRA_DIST = demo doc lib/js lib/ur xml \ src/coq src/*.sig src/*.sml src/*.mlb src/config.sml.in src/elisp src/*.cm src/sources src/*.grm src/*.lex \ CHANGELOG LICENSE urweb.ebuild include/urweb/*.h bin + +TESTDB = /tmp/urweb.db +TESTPID = /tmp/urweb.pid + +test: + urweb -dbms sqlite -db $(TESTDB) -demo /Demo demo + rm -f $(TESTDB) + sqlite3 $(TESTDB) < demo/demo.sql + demo/demo.exe & echo $$! > $(TESTPID) + sleep 1 + (curl -s 'http://localhost:8080/Demo/Hello/main' | diff tests/hello.html -) || (kill `cat $(TESTPID)`; echo "Test 'Hello' failed"; /bin/false) + (curl -s 'http://localhost:8080/Demo/Crud1/create?A=1&B=2&C=3&D=4' | diff tests/crud1.html -) || (kill `cat $(TESTPID)`; echo "Test 'Crud1' failed"; /bin/false) + kill `cat $(TESTPID)` + echo Tests succeeded. diff --git a/tests/crud1.html b/tests/crud1.html new file mode 100644 index 00000000..7ed26d30 --- /dev/null +++ b/tests/crud1.html @@ -0,0 +1,38 @@ + + + +

Inserted with ID 1.

+ + + + + + + + + + + + + + + + + + + +
IDABCD
1123True +[Update] +[Delete] +
+


+ +
+
  • A:
  • +
  • B:
  • +
  • C:
  • +
  • D:
  • + +
    + + \ No newline at end of file diff --git a/tests/hello.html b/tests/hello.html new file mode 100644 index 00000000..9c249df0 --- /dev/null +++ b/tests/hello.html @@ -0,0 +1,10 @@ + + + + +Hello world! + + +

    Hello world!

    + + \ No newline at end of file -- cgit v1.2.3