summaryrefslogtreecommitdiffstats
path: root/debian/tests/yangre
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:55:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:55:11 +0000
commit8712cf23f0ebf5323f546a6b6363a27d12461b2d (patch)
treeaa6828b07e325da484988c86c36cba4e78a10629 /debian/tests/yangre
parentAdding upstream version 2.1.30. (diff)
downloadlibyang2-8712cf23f0ebf5323f546a6b6363a27d12461b2d.tar.xz
libyang2-8712cf23f0ebf5323f546a6b6363a27d12461b2d.zip
Adding debian version 2.1.30-2.debian/2.1.30-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/yangre31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/tests/yangre b/debian/tests/yangre
new file mode 100755
index 0000000..7ef17f9
--- /dev/null
+++ b/debian/tests/yangre
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+set -e
+
+cleanup() {
+ if [ -n "${patternsfile}" ]; then
+ rm -f "${patternsfile}"
+ fi
+}
+trap cleanup EXIT
+
+# All these tests were taken from the yangre(1) manpage
+echo "Testing plain regular expression"
+yangre -p 'te.*xt' text_text
+
+echo "Testing multiple patterns"
+yangre -p '.*pat1' -p 'pat2.*' pat2testpat1
+
+echo "Testing multiple patterns including an inverted one"
+yangre -p '.*pat1' -p 'pat2.*' -p 'notpat' -i pat2testpat1
+
+echo "Testing multiple patterns, including an inverted one, via a file"
+patternsfile=$(mktemp)
+cat > "${patternsfile}" <<EOF
+.*pat1
+pat2.*
+ notpat
+
+pat2testpat1
+EOF
+yangre -f "${patternsfile}"