commit - c38046f2c8825d2f3be5229c7feb37a505e96fd6
commit + 46b59c355f85536cc7608f5a726f50c21d8e5bfc
blob - 2b1bf087080c157f7c417e0c8ca9f9b2814b5df5
blob + c43ea87f0e61935c280fe7fb43413ae205963d3c
--- exercise
+++ exercise
}
set argc [llength $argv]
+ # more environment variables
+ if {[info exists env(VERBOSE)] && $env(VERBOSE) ne ""} {
+ if {[string is false $env(VERBOSE)]} {set env(VERBOSE) 0}
+ if {![string is integer $env(VERBOSE)]} {set env(VERBOSE) 1}
+ if {$env(VERBOSE) > $opts(-v)} {set opts(-v) $env(VERBOSE)}
+ }
+
# change into workdir if requested with -C
if {[info exists opts(-C)]} {cd $opts(-C)}
blob - 8c973ee467abc39802e149a9abc5ffbc17f51472
blob + 7d8649868fc32131e540edc0d12a89ba318348e2
--- exercise.1
+++ exercise.1
it is interpreted after any
.Fl C
option takes effect.
+.It Ev VERBOSE
+If set to a positive integer,
+requests a verbosity level corresponding to an equal number of
+.Fl v
+options.
+If both
+.Fl v
+and
+.Ev VERBOSE
+are used,
+the higher level takes precedence.
.El
.
.Sh EXIT STATUS
blob - /dev/null
blob + beeccea84e4874eb065284c742b2ee60890eb618 (mode 755)
--- /dev/null
+++ tests/exercise/env/VERBOSE.t
+#!/bin/sh
+
+set -e
+
+
+env="VERBOSE=1" \
+./assert-exercise $0 \
+ "> $0.tst\nrun 1 ok 1 fail 0 error 0\n" \
+ '' \
+ <<EOF
+#!/bin/sh
+ exit 0
+EOF
+
+env="VERBOSE=1" \
+./assert-exercise $0 \
+ "> $0.tst\n" \
+ '' \
+ -q <<EOF
+#!/bin/sh
+ exit 0
+EOF
+
+env="VERBOSE=2" \
+./assert-exercise $0 \
+ "> $0.tst\n> > hallo welt\nrun 1 ok 1 fail 0 error 0\n" \
+ '' \
+ <<EOF
+#!/bin/sh
+ echo hallo welt
+EOF
+
+env="VERBOSE=2" \
+./assert-exercise $0 \
+ "> $0.tst\n> > hallo welt\nrun 1 ok 1 fail 0 error 0\n" \
+ '' \
+ -v <<EOF
+#!/bin/sh
+ echo hallo welt
+EOF
+
+env="VERBOSE=1" \
+./assert-exercise $0 \
+ "> $0.tst\n> > hallo welt\nrun 1 ok 1 fail 0 error 0\n" \
+ '' \
+ -vv <<EOF
+#!/bin/sh
+ echo hallo welt
+EOF
+
+env="VERBOSE=1" \
+tst=$0.ts \
+./assert-exercise $0 \
+ "> $0.ts\n> > test1\n> > test2\nrun 2 ok 2 fail 0 error 0\n" \
+ '' \
+ <<EOF
+#!/bin/sh
+ echo "run 2 ok 0 fail 0 error 0"
+ echo "> test1"
+ echo "run 2 ok 1 fail 0 error 0"
+ echo "> test2"
+ echo "run 2 ok 2 fail 0 error 0"
+ test "\$VERBOSE" = "1"
+EOF
blob - 6bb2d48c8644b823b71bddc72cc52af2181624b3
blob + edf5472e49e45477b8917867af67ef64b6196d2f
--- tests/helpers/assert-exercise
+++ tests/helpers/assert-exercise
# execute & compare
shift 3
-unset EXERCISEDIR # clean environment
+unset EXERCISEDIR VERBOSE # clean environment
env $env $exe "$@" "$pth" 1>$out 2>$err
test "$?" = "127" && exit 127
diff -u $experr $err >&2 && \