Mercurial > urweb
changeset 2246:4769b27aa436
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sun, 02 Aug 2015 18:26:44 -0700 |
parents | 27899da8780b 728aaeea12fd |
children | 565da55a4e18 |
files | |
diffstat | 3 files changed, 63 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Sun Aug 02 18:25:42 2015 -0700 +++ b/Makefile.am Sun Aug 02 18:26:44 2015 -0700 @@ -15,7 +15,7 @@ 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 @@ 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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/crud1.html Sun Aug 02 18:26:44 2015 -0700 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head></head><body> +<p>Inserted with ID 1.</p> + +<table border="1"> +<tr> +<th>ID</th> +<th>A</th> +<th>B</th> +<th>C</th> +<th>D</th> +</tr> + +<tr> +<td>1</td> +<td>1</td> +<td>2</td> +<td>3</td> +<td>True</td> +<td> +<a href="/Demo/Crud1/upd/1">[Update]</a> +<a href="/Demo/Crud1/confirm/1">[Delete]</a> +</td> +</tr> + +</table> +<br /><hr /><br /> + + <form method="post" action="/Demo/Crud1/create"> +<li> A: <input type="text" name="A" /></li> +<li> B: <input type="text" name="B" /></li> +<li> C: <input type="text" name="C" /></li> +<li> D: <input type="checkbox" name="D" /></li> +<input type="submit" /> +</form> + +</body></html> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/hello.html Sun Aug 02 18:26:44 2015 -0700 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<title>Hello world!</title> +</head> +<body> +<h1>Hello world!</h1> +</body> +</html> \ No newline at end of file