summaryrefslogtreecommitdiffstats
path: root/debian/tests/yangre
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:20:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:20:26 +0000
commita9844866100a315fe6586cf0bdb15b2a674fddf4 (patch)
treee6f6a3f0ea7dc635758320afb4ea9b956b88981b /debian/tests/yangre
parentAdding upstream version 2.1.30. (diff)
downloadlibyang2-a9844866100a315fe6586cf0bdb15b2a674fddf4.tar.xz
libyang2-a9844866100a315fe6586cf0bdb15b2a674fddf4.zip
Adding debian version 2.1.30-2.1.debian/2.1.30-2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/yangre')
-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}"