github.com/varialus/godfly@v0.0.0-20130904042352-1934f9f095ab/doc/articles/wiki/test.bash (about) 1 #!/usr/bin/env bash 2 # Copyright 2010 The Go Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 set -e 7 wiki_pid= 8 cleanup() { 9 kill $wiki_pid 10 rm -f test_*.out Test.txt final-test.bin final-test.go 11 } 12 trap cleanup 0 INT 13 14 go build -o get.bin get.go 15 addr=$(./get.bin -addr) 16 sed s/:8080/$addr/ < final.go > final-test.go 17 go build -o final-test.bin final-test.go 18 (./final-test.bin) & 19 wiki_pid=$! 20 21 ./get.bin --wait_for_port=5s http://$addr/edit/Test > test_edit.out 22 diff -u test_edit.out test_edit.good 23 ./get.bin -post=body=some%20content http://$addr/save/Test > test_save.out 24 diff -u test_save.out test_view.good # should be the same as viewing 25 diff -u Test.txt test_Test.txt.good 26 ./get.bin http://$addr/view/Test > test_view.out 27 diff -u test_view.out test_view.good 28 29 echo PASS