aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/script/parser.cxx2
-rw-r--r--tests/test/script/runner/for.testscript23
2 files changed, 18 insertions, 7 deletions
diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx
index 7989c20..a2e0819 100644
--- a/libbuild2/script/parser.cxx
+++ b/libbuild2/script/parser.cxx
@@ -2521,7 +2521,7 @@ namespace build2
stream_reader sr (
move (in), pipe,
- ops.whitespace (), ops.newline (), ops.exact (),
+ !ops.newline (), ops.newline (), ops.exact (),
dl, deadline_cmd,
ll);
diff --git a/tests/test/script/runner/for.testscript b/tests/test/script/runner/for.testscript
index 1ac7666..85ea765 100644
--- a/tests/test/script/runner/for.testscript
+++ b/tests/test/script/runner/for.testscript
@@ -172,6 +172,17 @@
b
EOO
+ : both-sep-options
+ :
+ $c <<EOI && $b 2>>/~%EOE% != 0
+ echo "a b" | for -n -w x
+ echo $x >|
+ end
+ EOI
+ testscript:1:1: error: for: both -n|--newline and -w|--whitespace specified
+ %.+
+ EOE
+
: invalid-option
:
$c <<EOI && $b 2>>/~%EOE% != 0
@@ -183,7 +194,6 @@
%.+
EOE
-
: no-variable
:
$c <<EOI && $b 2>>/~%EOE% != 0
@@ -219,7 +229,7 @@
: exit
:
$c <<EOI && $b >>EOO
- for x: a b
+ echo "a b" | for x
echo "$x" >|
exit
end
@@ -230,7 +240,7 @@
: error
:
$c <<EOI && $b >>EOO 2>>EOE != 0
- for x: a b
+ echo "a b" | for x
echo "$x" >|
exit 'fed up'
end
@@ -325,7 +335,8 @@
echo $x >|
end
EOI
- a b/
+ a/
+ b/
EOO
: nested
@@ -419,7 +430,7 @@
: exit
:
$c <<EOI && $b >>EOO
- for x: a b
+ for x <"a b"
echo "$x" >|
exit
end
@@ -430,7 +441,7 @@
: error
:
$c <<EOI && $b >>EOO 2>>EOE != 0
- for x: a b
+ for x <"a b"
echo "$x" >|
exit 'fed up'
end