summaryrefslogtreecommitdiff
path: root/test/args.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-06-24 15:31:03 -0700
committerRob Pike <r@golang.org>2008-06-24 15:31:03 -0700
commitfa4418a182c7c701c167a8119780d09fa4bc8ce0 (patch)
tree0942c906740dc658d937a24f45d8ca6809b282d8 /test/args.go
parente0a66f99cd1f76ccc91ec58673fc95d0ffe032ee (diff)
downloadgo-fa4418a182c7c701c167a8119780d09fa4bc8ce0.tar.gz
arguments available
argc, argv, envc, envv all in sys now sys.argc() etc. SVN=124398
Diffstat (limited to 'test/args.go')
-rw-r--r--test/args.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/args.go b/test/args.go
new file mode 100644
index 000000000..684cc4600
--- /dev/null
+++ b/test/args.go
@@ -0,0 +1,19 @@
+// $G $F.go && $L $F.$A && ./$A.out arg1 arg2
+
+// 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
+
+func main() {
+ if sys.argc() != 3 {
+ panic "argc"
+ }
+ if sys.argv(1) != "arg1" {
+ panic "arg1"
+ }
+ if sys.argv(2) != "arg2" {
+ panic "arg2"
+ }
+}