aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-12-03 16:38:26 -0800
committerRob Landley <rob@landley.net>2020-12-07 00:46:54 -0600
commit50d8ed89b1e02917e83a33b3d62f465192dd500f (patch)
treee4a6d1fccb19b58b8d4adf162e5450380e53ca12 /tests
parented3d5eb0eaf74e6686bc2576b2c4d5a5343dfd57 (diff)
downloadtoybox-50d8ed89b1e02917e83a33b3d62f465192dd500f.tar.gz
sed: add 'x' flag to the 's' command.
The GNU tar manual, when talking about the `tar --transform` option that I need to implement, describes the 'x' flag by saying "regexp is an extended regular expression (see section 'Extended regular expressions' in GNU sed)". Only it turns out that even the latest GNU sed doesn't actually have that flag. It's unique to `tar --transform`. That link is just telling you that the sed manual will explain extended regular expressions, not that GNU sed also supports the 'x' flag. So I don't know whether we want this in toybox sed after all. (It made sense that sed would have such a flag, but no sed that I know of actually does.)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/sed.test2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/sed.test b/tests/sed.test
index beb11d5c..c3928e58 100755
--- a/tests/sed.test
+++ b/tests/sed.test
@@ -185,6 +185,8 @@ testing '\n with empty capture' \
testing '\n too high' \
'sed -E "s/(.*)/\2/p" 2>/dev/null || echo OK' "OK\n" "" "foo"
+toyonly testing 's///x' 'sed "s/(hello )?(world)/\2/x"' "world" "" "hello world"
+
# Performance test
X=x; Y=20; while [ $Y -gt 0 ]; do X=$X$X; Y=$(($Y-1)); done
testing 'megabyte s/x/y/g (20 sec timeout)' \