summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/remembering.go23
-rwxr-xr-xtests/signals.sh8
2 files changed, 27 insertions, 4 deletions
diff --git a/tests/remembering.go b/tests/remembering.go
index 3f8e446..5c3b705 100644
--- a/tests/remembering.go
+++ b/tests/remembering.go
@@ -505,6 +505,29 @@ func test_run_flow() {
assertEq(out, "x\n")
assertEq(errW, "warn\n")
})
+
+ testing("attached -pNAME is accepted", func() {
+ rc, out, _ := runWith(
+ "b\na\n",
+ "-pt8", "--", "head", "-n1",
+ )
+ assertEq(rc, 0)
+ assertEq(out, "a\n")
+ assertEq(
+ profileContent("t8"),
+ "1 profile a\n0 profile b\n",
+ )
+ })
+
+ testing("-- shields the command's argv", func() {
+ rc, out, _ := runWith(
+ "",
+ "-p", "t9", "--",
+ "sh", "-c", "echo \"$0\"", "-pz",
+ )
+ assertEq(rc, 0)
+ assertEq(out, "-pz\n")
+ })
})
}
diff --git a/tests/signals.sh b/tests/signals.sh
index e1cb063..368a096 100755
--- a/tests/signals.sh
+++ b/tests/signals.sh
@@ -12,15 +12,15 @@ test_status_is_zero_when_command_is_successful() {
testing 'status is 0 when command is successful'
N="$LINENO"
- printf 'a\n' | "$REMEMBERING" -p p1 -- head -n1 1>/dev/null 2>/dev/null
+ printf 'a\n' | "$REMEMBERING" -pp1 -- head -n1 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
- printf '' | "$REMEMBERING" -p p2 -- true 1>/dev/null 2>/dev/null
+ printf '' | "$REMEMBERING" -pp2 -- true 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
- seq 9 | "$REMEMBERING" -p p3 -- grep 7 1>/dev/null 2>/dev/null
+ seq 9 | "$REMEMBERING" -pp3 -- grep 7 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
@@ -31,7 +31,7 @@ test_status_is_forwarded_from_command() {
testing 'status is forwarded from command'
N="$LINENO"
for status in $(seq 1 125); do
- printf '' | "$REMEMBERING" -p p4 -- sh -c "exit $status" 1>/dev/null 2>/dev/null
+ printf '' | "$REMEMBERING" -pp4 -- sh -c "exit $status" 1>/dev/null 2>/dev/null
STATUS=$?
assert_status "$status"
done