docs: update tests/examples

This commit is contained in:
Daniel Langbein 2023-03-20 19:54:46 +01:00
parent 78675f3c13
commit b1327063a4
4 changed files with 37 additions and 1 deletions

View File

@ -10,3 +10,9 @@ repl='Exec = /bin/foo BAR BAZ'
string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)" string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)"
printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}" printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}"
# RESULT>>>
# alpha = a
# beta = b
# Exec = /bin/foo BAR BAZ
# end = EOF
# <<<RESULT

View File

@ -4,9 +4,13 @@ string='alpha = a
beta = b beta = b
Exec = foo bar baz Exec = foo bar baz
end = EOF' end = EOF'
pattern='= b\nExec =' pattern='= b\nExec = .*\nend ='
repl='=' repl='='
string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)" string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)"
printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}" printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}"
# RESULT>>>
# alpha = a
# beta = EOF
# <<<RESULT

17
test/test_multiline_pattern2.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env sh
string='alpha = a
beta = b
Exec = foo bar baz
end = EOF'
pattern='= b\nExec = .*$'
repl='= ?'
string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)"
printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}"
# RESULT>>>
# alpha = a
# beta = ?
# end = EOF
# <<<RESULT

View File

@ -10,3 +10,12 @@ repl='foo bar baz\n\n o.O\n'
string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)" string="$(printf '%s' "${string}" | ../src/py_regex_replace/main.py -p "${pattern}" -r "${repl}" -c 1)"
printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}" printf 'RESULT>>>\n%s\n<<<RESULT\n' "${string}"
# RESULT>>>
# alpha = a
# beta = b
# Exec = foo bar baz
#
# o.O
#
# end = EOF
# <<<RESULT