summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2012-09-03 03:49:03 +0800
committerShenghou Ma <minux.ma@gmail.com>2012-09-03 03:49:03 +0800
commit31f104e24ff32d345ce3d04a511fde94494a1dec (patch)
tree02ec731b0e3a6f9429e03842c0521f8f61ed5ceb
parent6e1328796c5fb8cf00d81e78f20f424083fc7f48 (diff)
downloadgo-31f104e24ff32d345ce3d04a511fde94494a1dec.tar.gz
doc/progs: use test/run.go for testing on Windows
cgo[1-4].go, go1.go couldn't be tested now (cgo[1-4].go can only be tested when cgo is enabled, go1.go contain a list of filenames in the current directory) R=golang-dev, alex.brainman, rsc CC=golang-dev http://codereview.appspot.com/6218048
-rw-r--r--doc/Makefile5
-rw-r--r--doc/effective_go.html2
-rw-r--r--doc/progs/cgo1.go2
-rw-r--r--doc/progs/cgo2.go2
-rw-r--r--doc/progs/cgo3.go2
-rw-r--r--doc/progs/cgo4.go2
-rw-r--r--doc/progs/defer.go2
-rw-r--r--doc/progs/defer.out3
-rw-r--r--doc/progs/defer2.go2
-rw-r--r--doc/progs/defer2.out12
-rw-r--r--doc/progs/eff_bytesize.go2
-rw-r--r--doc/progs/eff_bytesize.out1
-rw-r--r--doc/progs/eff_qr.go6
-rw-r--r--doc/progs/eff_sequence.go2
-rw-r--r--doc/progs/eff_sequence.out1
-rw-r--r--doc/progs/error.go2
-rw-r--r--doc/progs/error2.go2
-rw-r--r--doc/progs/error3.go2
-rw-r--r--doc/progs/error4.go2
-rw-r--r--doc/progs/go1.go3
-rw-r--r--doc/progs/gobs1.go2
-rw-r--r--doc/progs/gobs2.go2
-rw-r--r--doc/progs/image_draw.go2
-rw-r--r--doc/progs/image_package1.go2
-rw-r--r--doc/progs/image_package1.out1
-rw-r--r--doc/progs/image_package2.go2
-rw-r--r--doc/progs/image_package2.out1
-rw-r--r--doc/progs/image_package3.go2
-rw-r--r--doc/progs/image_package3.out1
-rw-r--r--doc/progs/image_package4.go2
-rw-r--r--doc/progs/image_package4.out1
-rw-r--r--doc/progs/image_package5.go2
-rw-r--r--doc/progs/image_package5.out1
-rw-r--r--doc/progs/image_package6.go2
-rw-r--r--doc/progs/image_package6.out2
-rw-r--r--doc/progs/interface.go2
-rw-r--r--doc/progs/interface2.go2
-rw-r--r--doc/progs/interface2.out1
-rw-r--r--doc/progs/json1.go2
-rw-r--r--doc/progs/json2.go2
-rw-r--r--doc/progs/json2.out2
-rw-r--r--doc/progs/json3.go2
-rw-r--r--doc/progs/json4.go2
-rw-r--r--doc/progs/json5.go2
-rw-r--r--doc/progs/slices.go2
-rw-r--r--doc/progs/timeout1.go2
-rw-r--r--doc/progs/timeout2.go2
-rwxr-xr-xdoc/progs/update.bash15
-rw-r--r--src/run.bat10
49 files changed, 128 insertions, 2 deletions
diff --git a/doc/Makefile b/doc/Makefile
index b6e475b84..23262da94 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -25,3 +25,8 @@ all: $(RAWHTML)
clean:
rm -f $(RAWHTML)
+
+compare:
+ for i in $(RAWHTML); do \
+ godoc -url /doc/$${i/.rawhtml/.html} | diff -u $$i -; \
+ done
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 6cacac630..fc793591b 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -2973,7 +2973,7 @@ for instance, a URL, saving you typing the URL into the phone's tiny keyboard.
Here's the complete program.
An explanation follows.
</p>
-{{code "/doc/progs/eff_qr.go"}}
+{{code "/doc/progs/eff_qr.go" `/package/` `$`}}
<p>
The pieces up to <code>main</code> should be easy to follow.
The one flag sets a default HTTP port for our server. The template
diff --git a/doc/progs/cgo1.go b/doc/progs/cgo1.go
index b79ee368a..1a2dc6c96 100644
--- a/doc/progs/cgo1.go
+++ b/doc/progs/cgo1.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo2.go b/doc/progs/cgo2.go
index f38473b13..9999af344 100644
--- a/doc/progs/cgo2.go
+++ b/doc/progs/cgo2.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo3.go b/doc/progs/cgo3.go
index 435fd0402..c4f4791e8 100644
--- a/doc/progs/cgo3.go
+++ b/doc/progs/cgo3.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/cgo4.go b/doc/progs/cgo4.go
index 3808d6217..30b893572 100644
--- a/doc/progs/cgo4.go
+++ b/doc/progs/cgo4.go
@@ -1,3 +1,5 @@
+// skip
+
// Copyright 2012 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.
diff --git a/doc/progs/defer.go b/doc/progs/defer.go
index 2e11020ab..006a474b5 100644
--- a/doc/progs/defer.go
+++ b/doc/progs/defer.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/defer.out b/doc/progs/defer.out
new file mode 100644
index 000000000..0cdf53a27
--- /dev/null
+++ b/doc/progs/defer.out
@@ -0,0 +1,3 @@
+0
+3210
+2
diff --git a/doc/progs/defer2.go b/doc/progs/defer2.go
index cad66b070..ff7eaf9d8 100644
--- a/doc/progs/defer2.go
+++ b/doc/progs/defer2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/defer2.out b/doc/progs/defer2.out
new file mode 100644
index 000000000..6110685cd
--- /dev/null
+++ b/doc/progs/defer2.out
@@ -0,0 +1,12 @@
+Calling g.
+Printing in g 0
+Printing in g 1
+Printing in g 2
+Printing in g 3
+Panicking!
+Defer in g 3
+Defer in g 2
+Defer in g 1
+Defer in g 0
+Recovered in f 4
+Returned normally from f.
diff --git a/doc/progs/eff_bytesize.go b/doc/progs/eff_bytesize.go
index b45961114..a0c3d5058 100644
--- a/doc/progs/eff_bytesize.go
+++ b/doc/progs/eff_bytesize.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2009 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.
diff --git a/doc/progs/eff_bytesize.out b/doc/progs/eff_bytesize.out
new file mode 100644
index 000000000..df763f3b3
--- /dev/null
+++ b/doc/progs/eff_bytesize.out
@@ -0,0 +1 @@
+1.00YB 9.09TB
diff --git a/doc/progs/eff_qr.go b/doc/progs/eff_qr.go
index de96a0208..4ac745c93 100644
--- a/doc/progs/eff_qr.go
+++ b/doc/progs/eff_qr.go
@@ -1,3 +1,9 @@
+// compile
+
+// Copyright 2009 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.
+
package main
import (
diff --git a/doc/progs/eff_sequence.go b/doc/progs/eff_sequence.go
index 11c885abf..c9b18ba93 100644
--- a/doc/progs/eff_sequence.go
+++ b/doc/progs/eff_sequence.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2009 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.
diff --git a/doc/progs/eff_sequence.out b/doc/progs/eff_sequence.out
new file mode 100644
index 000000000..fd01a7d47
--- /dev/null
+++ b/doc/progs/eff_sequence.out
@@ -0,0 +1 @@
+[-1 2 6 16 44]
diff --git a/doc/progs/error.go b/doc/progs/error.go
index f85a5273a..f50732665 100644
--- a/doc/progs/error.go
+++ b/doc/progs/error.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error2.go b/doc/progs/error2.go
index 2b0e0c356..aad1dc8e8 100644
--- a/doc/progs/error2.go
+++ b/doc/progs/error2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error3.go b/doc/progs/error3.go
index e4e57e077..9f1b30072 100644
--- a/doc/progs/error3.go
+++ b/doc/progs/error3.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/error4.go b/doc/progs/error4.go
index 8f35cf74b..bf234c98f 100644
--- a/doc/progs/error4.go
+++ b/doc/progs/error4.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/go1.go b/doc/progs/go1.go
index 50fd93441..a4dc64d46 100644
--- a/doc/progs/go1.go
+++ b/doc/progs/go1.go
@@ -1,3 +1,6 @@
+// compile
+// this file will output a list of filenames in cwd, not suitable for cmpout
+
// Copyright 2011 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.
diff --git a/doc/progs/gobs1.go b/doc/progs/gobs1.go
index 7077ca159..d95f765d8 100644
--- a/doc/progs/gobs1.go
+++ b/doc/progs/gobs1.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/gobs2.go b/doc/progs/gobs2.go
index 85bb41cdc..acd18382f 100644
--- a/doc/progs/gobs2.go
+++ b/doc/progs/gobs2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2011 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.
diff --git a/doc/progs/image_draw.go b/doc/progs/image_draw.go
index bb73c8a71..0a1f7acb1 100644
--- a/doc/progs/image_draw.go
+++ b/doc/progs/image_draw.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package1.go b/doc/progs/image_package1.go
index c4c401e72..d331834fc 100644
--- a/doc/progs/image_package1.go
+++ b/doc/progs/image_package1.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package1.out b/doc/progs/image_package1.out
new file mode 100644
index 000000000..809b31bf6
--- /dev/null
+++ b/doc/progs/image_package1.out
@@ -0,0 +1 @@
+X is 2 Y is 1
diff --git a/doc/progs/image_package2.go b/doc/progs/image_package2.go
index fcb5d9fd0..e5b78b485 100644
--- a/doc/progs/image_package2.go
+++ b/doc/progs/image_package2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package2.out b/doc/progs/image_package2.out
new file mode 100644
index 000000000..616d3078b
--- /dev/null
+++ b/doc/progs/image_package2.out
@@ -0,0 +1 @@
+3 4 false
diff --git a/doc/progs/image_package3.go b/doc/progs/image_package3.go
index 13d0f0807..95d72a0b2 100644
--- a/doc/progs/image_package3.go
+++ b/doc/progs/image_package3.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package3.out b/doc/progs/image_package3.out
new file mode 100644
index 000000000..3fe35dea5
--- /dev/null
+++ b/doc/progs/image_package3.out
@@ -0,0 +1 @@
+3 4 true
diff --git a/doc/progs/image_package4.go b/doc/progs/image_package4.go
index c46fddf07..ec0e4613d 100644
--- a/doc/progs/image_package4.go
+++ b/doc/progs/image_package4.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package4.out b/doc/progs/image_package4.out
new file mode 100644
index 000000000..cb1b7776b
--- /dev/null
+++ b/doc/progs/image_package4.out
@@ -0,0 +1 @@
+image.Point{X:2, Y:1}
diff --git a/doc/progs/image_package5.go b/doc/progs/image_package5.go
index 0bb5c7608..b9e27d6da 100644
--- a/doc/progs/image_package5.go
+++ b/doc/progs/image_package5.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package5.out b/doc/progs/image_package5.out
new file mode 100644
index 000000000..2da80c1fb
--- /dev/null
+++ b/doc/progs/image_package5.out
@@ -0,0 +1 @@
+{255 0 0 255}
diff --git a/doc/progs/image_package6.go b/doc/progs/image_package6.go
index 62eeecdb9..5e6eefa04 100644
--- a/doc/progs/image_package6.go
+++ b/doc/progs/image_package6.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/image_package6.out b/doc/progs/image_package6.out
new file mode 100644
index 000000000..fcd13c0c0
--- /dev/null
+++ b/doc/progs/image_package6.out
@@ -0,0 +1,2 @@
+8 4
+true
diff --git a/doc/progs/interface.go b/doc/progs/interface.go
index c2925d590..6972b7287 100644
--- a/doc/progs/interface.go
+++ b/doc/progs/interface.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/interface2.go b/doc/progs/interface2.go
index a541d94e4..85e7d5163 100644
--- a/doc/progs/interface2.go
+++ b/doc/progs/interface2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/interface2.out b/doc/progs/interface2.out
new file mode 100644
index 000000000..085bd017a
--- /dev/null
+++ b/doc/progs/interface2.out
@@ -0,0 +1 @@
+type: float64
diff --git a/doc/progs/json1.go b/doc/progs/json1.go
index 9e10f4743..887d7d183 100644
--- a/doc/progs/json1.go
+++ b/doc/progs/json1.go
@@ -1,3 +1,5 @@
+// run
+
// Copyright 2012 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.
diff --git a/doc/progs/json2.go b/doc/progs/json2.go
index 6089ae671..f358feaa2 100644
--- a/doc/progs/json2.go
+++ b/doc/progs/json2.go
@@ -1,3 +1,5 @@
+// cmpout
+
// Copyright 2012 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.
diff --git a/doc/progs/json2.out b/doc/progs/json2.out
new file mode 100644
index 000000000..8f2dea57d
--- /dev/null
+++ b/doc/progs/json2.out
@@ -0,0 +1,2 @@
+the circle's area 24.227111172875365
+the reciprocal of i is 0.3601008282319049
diff --git a/doc/progs/json3.go b/doc/progs/json3.go
index a04fdfa50..41eb3730c 100644
--- a/doc/progs/json3.go
+++ b/doc/progs/json3.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/json4.go b/doc/progs/json4.go
index 492630220..ee38f31ad 100644
--- a/doc/progs/json4.go
+++ b/doc/progs/json4.go
@@ -1,3 +1,5 @@
+// run
+
// Copyright 2012 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.
diff --git a/doc/progs/json5.go b/doc/progs/json5.go
index 6d7a4ca8c..9ab972df8 100644
--- a/doc/progs/json5.go
+++ b/doc/progs/json5.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/slices.go b/doc/progs/slices.go
index 8e440103e..0461684b7 100644
--- a/doc/progs/slices.go
+++ b/doc/progs/slices.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/timeout1.go b/doc/progs/timeout1.go
index 5221770ec..fbc39caac 100644
--- a/doc/progs/timeout1.go
+++ b/doc/progs/timeout1.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/timeout2.go b/doc/progs/timeout2.go
index 7145bc93e..a12bc2ab1 100644
--- a/doc/progs/timeout2.go
+++ b/doc/progs/timeout2.go
@@ -1,3 +1,5 @@
+// compile
+
// Copyright 2012 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.
diff --git a/doc/progs/update.bash b/doc/progs/update.bash
new file mode 100755
index 000000000..d4ecfbeba
--- /dev/null
+++ b/doc/progs/update.bash
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# Copyright 2012 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
+
+rm -f *.out *.rej *.orig [568].out
+
+for i in *.go; do
+ if grep -q '^// cmpout$' $i; then
+ echo $i
+ go run $i &> ${i/.go/.out}
+ fi
+done
diff --git a/src/run.bat b/src/run.bat
index 64398ccc5..471192662 100644
--- a/src/run.bat
+++ b/src/run.bat
@@ -70,7 +70,10 @@ go run %GOROOT%\test\run.go - ..\misc\cgo\life
if errorlevel 1 goto fail
echo.
-:: TODO ..\misc\cgo\stdio
+echo # ..\misc\cgo\stdio
+go run %GOROOT%\test\run.go - ..\misc\cgo\stdio
+if errorlevel 1 goto fail
+echo.
:: TODO(brainman): disabled, because it fails with: mkdir C:\Users\ADMINI~1\AppData\Local\Temp\2.....\go\misc\cgo\: The filename or extension is too long.
::echo # ..\misc\cgo\test
@@ -79,6 +82,11 @@ echo.
::echo.
:nocgo
+echo # ..\doc\progs
+go run %GOROOT%\test\run.go - ..\doc\progs
+if errorlevel 1 goto fail
+echo.
+
:: TODO: The other tests in run.bash.
echo # test