Skip to content

Commit

Permalink
test: Improve comment handling testing
Browse files Browse the repository at this point in the history
The previous test/parsing/comment* files were too simple.

Now I've added corner cases, bug raising samples (using ";", see
issues #49 and #50) and a more complete coverage.
  • Loading branch information
aureliojargas committed Sep 21, 2019
1 parent db438d4 commit cc48068
Show file tree
Hide file tree
Showing 12 changed files with 1,372 additions and 145 deletions.
18 changes: 6 additions & 12 deletions test/debug/comment.gnu.sed.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
PATT:one$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:one$
HOLD:$
one
PATT:two$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:two$
HOLD:$
two
PATT:three$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:three$
HOLD:$
three
PATT:four$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:four$
HOLD:$
four
PATT:five$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:five$
HOLD:$
five
PATT:six$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:six$
HOLD:$
six
18 changes: 6 additions & 12 deletions test/debug/comment.sed.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
PATT:one$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:one$
HOLD:$
one
PATT:two$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:two$
HOLD:$
two
PATT:three$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:three$
HOLD:$
three
PATT:four$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:four$
HOLD:$
four
PATT:five$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:five$
HOLD:$
five
PATT:six$
HOLD:$
COMM:/bla/ {
COMM:s///
COMM:/foo/ {
PATT:six$
HOLD:$
six
175 changes: 162 additions & 13 deletions test/dumpdebug/comment.gnu.sed
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# GNU sed accepts end-of-line comments with no ; before.
### foo
#foo
#
s/^/PATT:/
l
s/^PATT://
Expand All @@ -8,14 +11,17 @@
s/^HOLD://
x
i\
COMM:/bla/ {
COMM:/foo/ {
#--------------------------------------------------
/bla/ {
# at this address
/foo/ {
# c1
i\
COMM:h
COMM:c\\\\N1
#--------------------------------------------------
h
c\
1
# foo;bar
#;
s/^/PATT:/
l
s/^PATT://
Expand All @@ -25,10 +31,9 @@ h
s/^HOLD://
x
i\
COMM:g
COMM:p
#--------------------------------------------------
g
#
p
s/^/PATT:/
l
s/^PATT://
Expand All @@ -38,14 +43,158 @@ g
s/^HOLD://
x
i\
COMM:}
COMM:p
#--------------------------------------------------
}
p
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:p
#--------------------------------------------------
p
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:p
#--------------------------------------------------
p
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:p
#--------------------------------------------------
p
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:p
#--------------------------------------------------
p
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:s/a/b/
#--------------------------------------------------
s/a/b/
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:s///
/bla/y/!/!/
COMM:s/a/b/
#--------------------------------------------------
s///
s/a/b/
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:s/a/b/gp
#--------------------------------------------------
s/a/b/gp
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:s/a/b/gp
#--------------------------------------------------
s/a/b/gp
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM::foo
#--------------------------------------------------
:foo
i\
COMM::foo
#--------------------------------------------------
:foo
i\
COMM:b foo
#--------------------------------------------------
b foo
i\
COMM:b foo
#--------------------------------------------------
b foo
i\
COMM:b
#--------------------------------------------------
b
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:b
#--------------------------------------------------
b
s/^/PATT:/
l
s/^PATT://
x
s/^/HOLD:/
l
s/^HOLD://
x
i\
COMM:}
#--------------------------------------------------
}
#
s/^/PATT:/
l
s/^PATT://
Expand Down
Loading

0 comments on commit cc48068

Please sign in to comment.