summaryrefslogtreecommitdiff
path: root/doc/codewalk/run
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2013-07-30 09:42:53 +1000
committerAndrew Gerrand <adg@golang.org>2013-07-30 09:42:53 +1000
commit2bc30423d89354dc9f0e9bbf9c9e4112fef07c3d (patch)
treef16140722b8d7730dc7d83a6302ddb642c385a3f /doc/codewalk/run
parent3de0ce8e68db6d1b567ddc3b3e02ce1671bd0098 (diff)
downloadgo-2bc30423d89354dc9f0e9bbf9c9e4112fef07c3d.tar.gz
doc/codewalk: test source code
Fixes issue 2648. R=golang-dev, r CC=golang-dev https://codereview.appspot.com/11331043
Diffstat (limited to 'doc/codewalk/run')
-rwxr-xr-xdoc/codewalk/run21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/codewalk/run b/doc/codewalk/run
new file mode 100755
index 000000000..1c7c5fc0d
--- /dev/null
+++ b/doc/codewalk/run
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# Copyright 2013 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+set -e
+
+function fail {
+ echo FAIL: doc/codewalk/$1
+ exit 1
+}
+
+# markov.xml
+echo foo | go run markov.go | grep foo > /dev/null || fail markov
+
+# functions.xml
+go run pig.go | grep 'Wins, losses staying at k = 100: 210/990 (21.2%), 780/990 (78.8%)' > /dev/null || fail pig
+
+# sharemem.xml: only build the example, as it uses the network
+go build -o /dev/null urlpoll.go || fail urlpoll
+