summaryrefslogtreecommitdiff
path: root/busybox/testsuite/sed
diff options
context:
space:
mode:
authornobody <nobody@localhost>2004-10-13 09:42:10 +0000
committernobody <nobody@localhost>2004-10-13 09:42:10 +0000
commit8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373 (patch)
tree1826706cd4fd009fcd14f4f8021005ec8ec0fa59 /busybox/testsuite/sed
downloadbusybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.tar.gz
busybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.tar.bz2
busybox-w32-8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373.zip
This commit was manufactured by cvs2svn to create tag 'busybox_1_00'.
Diffstat (limited to 'busybox/testsuite/sed')
-rw-r--r--busybox/testsuite/sed/sed-accepts-blanks-before-command1
-rw-r--r--busybox/testsuite/sed/sed-aic-commands134
-rw-r--r--busybox/testsuite/sed/sed-append-hold-space-to-pattern-space13
-rw-r--r--busybox/testsuite/sed/sed-append-next-line19
-rw-r--r--busybox/testsuite/sed/sed-branch1
-rw-r--r--busybox/testsuite/sed/sed-branch-conditional15
-rw-r--r--busybox/testsuite/sed/sed-branch-conditional211
-rw-r--r--busybox/testsuite/sed/sed-branch-no-label1
-rw-r--r--busybox/testsuite/sed/sed-chains-substs1
-rw-r--r--busybox/testsuite/sed/sed-chains-substs21
-rw-r--r--busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line2
-rw-r--r--busybox/testsuite/sed/sed-handles-embedded-slashes1
-rw-r--r--busybox/testsuite/sed/sed-handles-empty-lines1
-rw-r--r--busybox/testsuite/sed/sed-handles-unsatisfied-backrefs6
-rw-r--r--busybox/testsuite/sed/sed-next-line12
-rw-r--r--busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs4
-rw-r--r--busybox/testsuite/sed/sed-recurses-properly1
-rw-r--r--busybox/testsuite/sed/sed-regex-match-newline10
-rw-r--r--busybox/testsuite/sed/sed-splits-edit-commands-on-command-line9
-rw-r--r--busybox/testsuite/sed/sed-subst-subprint9
-rw-r--r--busybox/testsuite/sed/sed-write-to-stdout10
21 files changed, 262 insertions, 0 deletions
diff --git a/busybox/testsuite/sed/sed-accepts-blanks-before-command b/busybox/testsuite/sed/sed-accepts-blanks-before-command
new file mode 100644
index 000000000..9597c2f8b
--- /dev/null
+++ b/busybox/testsuite/sed/sed-accepts-blanks-before-command
@@ -0,0 +1 @@
busybox sed -e '1 d' </dev/null
diff --git a/busybox/testsuite/sed/sed-aic-commands b/busybox/testsuite/sed/sed-aic-commands
new file mode 100644
index 000000000..b41c14ab8
--- /dev/null
+++ b/busybox/testsuite/sed/sed-aic-commands
@@ -0,0 +1,134 @@
1cat - >input <<EOF
22i\\
3before 2
45c\\
5Change 5
610a\\
7After 10
822i\\
9before 22\\
10Continued
1125c\\
12Change 25\\
13Continued
1420a\\
15After 20\\
16Continued
17 32i\\
18before 32\\
19Continued 1\\
20Continued 2\\
21Continued 3
22 35c\\
23Change 35\\
24Continued 1\\
25Continued 2\\
26Continued 3
27 30a\\
28After 30\\
29Continued 1\\
30Continued 2\\
31Continued 3
32EOF
33busybox sed -f input >output <<EOF
34 1 y
35 2 y
36 3 y
37 4 y
38 5 y
39 6 y
40 7 y
41 8 y
42 9 y
43 10 y
44 11 y
45 12 y
46 13 y
47 14 y
48 15 y
49 16 y
50 17 y
51 18 y
52 19 y
53 20 y
54 21 y
55 22 y
56 23 y
57 24 y
58 25 y
59 26 y
60 27 y
61 28 y
62 29 y
63 30 y
64 31 y
65 32 y
66 33 y
67 34 y
68 35 y
69 36 y
70 37 y
71 38 y
72 39 y
73 40 y
74EOF
75cmp -s output - <<EOF
76 1 y
77before 2
78 2 y
79 3 y
80 4 y
81Change 5
82 6 y
83 7 y
84 8 y
85 9 y
86 10 y
87After 10
88 11 y
89 12 y
90 13 y
91 14 y
92 15 y
93 16 y
94 17 y
95 18 y
96 19 y
97 20 y
98After 20
99Continued
100 21 y
101before 22
102Continued
103 22 y
104 23 y
105 24 y
106Change 25
107Continued
108 26 y
109 27 y
110 28 y
111 29 y
112 30 y
113After 30
114Continued 1
115Continued 2
116Continued 3
117 31 y
118before 32
119Continued 1
120Continued 2
121Continued 3
122 32 y
123 33 y
124 34 y
125Change 35
126Continued 1
127Continued 2
128Continued 3
129 36 y
130 37 y
131 38 y
132 39 y
133 40 y
134EOF
diff --git a/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space b/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space
new file mode 100644
index 000000000..6dda80fee
--- /dev/null
+++ b/busybox/testsuite/sed/sed-append-hold-space-to-pattern-space
@@ -0,0 +1,13 @@
1busybox sed 'G'>output <<EOF
2a
3b
4c
5EOF
6cmp -s output - <<EOF
7a
8
9b
10
11c
12
13EOF
diff --git a/busybox/testsuite/sed/sed-append-next-line b/busybox/testsuite/sed/sed-append-next-line
new file mode 100644
index 000000000..0621a319f
--- /dev/null
+++ b/busybox/testsuite/sed/sed-append-next-line
@@ -0,0 +1,19 @@
1# This will fail if CONFIG_FEATURE_SED_GNU_COMPATABILITY is defined
2busybox sed 'N;p'>output <<EOF
3a
4b
5c
6EOF
7
8set +e
9cmp -s output - <<EOF
10a
11b
12a
13b
14c
15EOF
16if [ $? != 0 ] ; then
17 exit 0;
18fi
19exit 1;
diff --git a/busybox/testsuite/sed/sed-branch b/busybox/testsuite/sed/sed-branch
new file mode 100644
index 000000000..4167569ad
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch
@@ -0,0 +1 @@
test "$(echo foo | busybox sed 'b one;p;: one')" = foo
diff --git a/busybox/testsuite/sed/sed-branch-conditional b/busybox/testsuite/sed/sed-branch-conditional
new file mode 100644
index 000000000..47d0a5ff2
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-conditional
@@ -0,0 +1,15 @@
1busybox sed 's/a/1/;t one;p;: one;p'>output <<EOF
2a
3b
4c
5EOF
6cmp -s output - <<EOF
71
81
9b
10b
11b
12c
13c
14c
15EOF
diff --git a/busybox/testsuite/sed/sed-branch-conditional2 b/busybox/testsuite/sed/sed-branch-conditional2
new file mode 100644
index 000000000..f4b11f0f8
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-conditional2
@@ -0,0 +1,11 @@
1#XFAIL
2busybox sed 's/a/b/;:loop;t loop'>output <<EOF
3a
4b
5c
6EOF
7cmp -s output - <<EOF
8b
9b
10c
11EOF
diff --git a/busybox/testsuite/sed/sed-branch-no-label b/busybox/testsuite/sed/sed-branch-no-label
new file mode 100644
index 000000000..446c1bcd9
--- /dev/null
+++ b/busybox/testsuite/sed/sed-branch-no-label
@@ -0,0 +1 @@
test "$(echo foo | busybox sed 'b;p')" = foo
diff --git a/busybox/testsuite/sed/sed-chains-substs b/busybox/testsuite/sed/sed-chains-substs
new file mode 100644
index 000000000..266936ac4
--- /dev/null
+++ b/busybox/testsuite/sed/sed-chains-substs
@@ -0,0 +1 @@
test "$(echo foo | busybox sed -e s/foo/bar/ -e s/bar/baz/)" = baz
diff --git a/busybox/testsuite/sed/sed-chains-substs2 b/busybox/testsuite/sed/sed-chains-substs2
new file mode 100644
index 000000000..90568f6e6
--- /dev/null
+++ b/busybox/testsuite/sed/sed-chains-substs2
@@ -0,0 +1 @@
test x"$(echo foo | busybox -n sed -e s/foo/bar/ -e s/foo/baz/)" = x
diff --git a/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line b/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line
new file mode 100644
index 000000000..6f106e104
--- /dev/null
+++ b/busybox/testsuite/sed/sed-does-not-substitute-in-deleted-line
@@ -0,0 +1,2 @@
1echo foo | busybox sed -e /foo/d -e s/foo/bar/ >foo
2cmp foo /dev/null
diff --git a/busybox/testsuite/sed/sed-handles-embedded-slashes b/busybox/testsuite/sed/sed-handles-embedded-slashes
new file mode 100644
index 000000000..cc287613d
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-embedded-slashes
@@ -0,0 +1 @@
test "$(echo fu/bar | busybox sed -e 's/[/]//')" = fubar
diff --git a/busybox/testsuite/sed/sed-handles-empty-lines b/busybox/testsuite/sed/sed-handles-empty-lines
new file mode 100644
index 000000000..2bb8f045a
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-empty-lines
@@ -0,0 +1 @@
test `echo | busybox sed -e 's/$/@/'` = @
diff --git a/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs b/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs
new file mode 100644
index 000000000..61bff8837
--- /dev/null
+++ b/busybox/testsuite/sed/sed-handles-unsatisfied-backrefs
@@ -0,0 +1,6 @@
1busybox sed -e 's/.*root=/\1/' >output <<EOF
2BOOT_IMAGE=vmlinuz root=/dev/hda5 initrd=init1
3EOF
4cmp -s output - <<EOF
5/dev/hda5 initrd=init1
6EOF
diff --git a/busybox/testsuite/sed/sed-next-line b/busybox/testsuite/sed/sed-next-line
new file mode 100644
index 000000000..38fe20cf2
--- /dev/null
+++ b/busybox/testsuite/sed/sed-next-line
@@ -0,0 +1,12 @@
1busybox sed 'n;p'>output <<EOF
2a
3b
4c
5EOF
6cmp -s output - <<EOF
7a
8b
9b
10c
11c
12EOF
diff --git a/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs b/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs
new file mode 100644
index 000000000..ba8955d6e
--- /dev/null
+++ b/busybox/testsuite/sed/sed-prints-line-once-for-multiple-substs
@@ -0,0 +1,4 @@
1busybox sed -e s/1/2/g -e s/3/4/g >output <<EOF
21
3EOF
4echo 2 | cmp -s output -
diff --git a/busybox/testsuite/sed/sed-recurses-properly b/busybox/testsuite/sed/sed-recurses-properly
new file mode 100644
index 000000000..a02667b41
--- /dev/null
+++ b/busybox/testsuite/sed/sed-recurses-properly
@@ -0,0 +1 @@
test "`echo '12345' | busybox sed -e 's/[[:space:]]*/,/g')` = ',1,2,3,4,5,'"
diff --git a/busybox/testsuite/sed/sed-regex-match-newline b/busybox/testsuite/sed/sed-regex-match-newline
new file mode 100644
index 000000000..1057e1718
--- /dev/null
+++ b/busybox/testsuite/sed/sed-regex-match-newline
@@ -0,0 +1,10 @@
1# FEATURE: CONFIG_FEATURE_SED_EMBEDED_NEWLINE
2busybox sed -n 'N;/a\nb/p'>output <<EOF
3a
4b
5c
6EOF
7cmp -s output - <<EOF
8a
9b
10EOF
diff --git a/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line b/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line
new file mode 100644
index 000000000..6421fa552
--- /dev/null
+++ b/busybox/testsuite/sed/sed-splits-edit-commands-on-command-line
@@ -0,0 +1,9 @@
1echo 2 | busybox sed -e 'i\
21
3a\
43' > output
5cmp output - <<EOF
61
72
83
9EOF
diff --git a/busybox/testsuite/sed/sed-subst-subprint b/busybox/testsuite/sed/sed-subst-subprint
new file mode 100644
index 000000000..24f8bad7d
--- /dev/null
+++ b/busybox/testsuite/sed/sed-subst-subprint
@@ -0,0 +1,9 @@
1busybox sed 's/foo/bar/p'>output <<EOF
2foo
3bar
4EOF
5cmp -s output - <<EOF
6bar
7bar
8bar
9EOF
diff --git a/busybox/testsuite/sed/sed-write-to-stdout b/busybox/testsuite/sed/sed-write-to-stdout
new file mode 100644
index 000000000..95b4d724b
--- /dev/null
+++ b/busybox/testsuite/sed/sed-write-to-stdout
@@ -0,0 +1,10 @@
1busybox sed -n 'N;P;p'>output <<EOF
2a
3b
4c
5EOF
6cmp -s output - <<EOF
7a
8a
9b
10EOF