mirror of
https://codeberg.org/privacy1st/py-regex-replace
synced 2024-12-23 02:36:05 +01:00
docs: update tests/examples
This commit is contained in:
parent
78675f3c13
commit
b1327063a4
@ -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
|
||||||
|
@ -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
17
test/test_multiline_pattern2.sh
Executable 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
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user