summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-06-05 16:10:21 -0400
committerOri Bernstein <ori@eigenstate.org>2013-06-05 16:10:21 -0400
commit954ff1977d4345d53a0e1996c7c3b39c51a2d470 (patch)
treed062fcf60fb5fa95708d994b4927b7a4dc2c8c37
parenteffa98dac67fd796ef9414afef330722657e45cb (diff)
downloadmc-954ff1977d4345d53a0e1996c7c3b39c51a2d470.tar.gz
Improve the test program a tad.
-rw-r--r--libstd/test.myr22
1 files changed, 16 insertions, 6 deletions
diff --git a/libstd/test.myr b/libstd/test.myr
index 4b142b7..3b52262 100644
--- a/libstd/test.myr
+++ b/libstd/test.myr
@@ -8,17 +8,21 @@ const main = {args : byte[:][:]
var o
var a
- std.put("args.len = %i\n", args.len)
- for i = 0; i < args.len; i++
- std.put("args[%i] = %s\n", i, args[i])
- ;;
-
- ctx = std.optinit("asdf:g?", args)
+ ctx = std.optinit("asdf:g?h", args)
std.put("arglen = %i\n", ctx.args.len)
while !std.optdone(ctx)
(o, a) = std.optnext(ctx)
+ if o == 'h'
+ usage()
+ ;;
std.put("option %c, arg = %s\n", o, a)
;;
+
+ std.put("args.len = %i\n", args.len)
+ for i = 0; i < args.len; i++
+ std.put("args[%i] = %s\n", i, args[i])
+ ;;
+
for i = 0; i < ctx.args.len; i++
std.put("arg %s\n", ctx.args[i])
;;
@@ -86,3 +90,9 @@ const testrng = {
;;
std.put("\n");
}
+
+const usage = {
+ std.put("Pokes a bit at the standard library.\n")
+ std.put("Option string is asdf:g?h\n")
+ std.exit(0)
+}