We should be testing the built tool everywhere, this also shrinks the
APKBUILD by quite a bit :)
---
CMakeLists.txt | 7 +++++++
tests.sh | 20 ++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100755 tests.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f348cc..665d073 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,13 @@ add_executable(
src/pnc.cc
)
+enable_testing()
+
+find_program(SH_PROG sh)
+if(SH_PROG)
+ add_test(tests_sh ${SH_PROG} ${CMAKE_CURRENT_SOURCE_DIR}/tests.sh ${CMAKE_CURRENT_BINARY_DIR})
+endif (SH_PROG)
+
target_link_libraries(
pnc
${LIBICUUC}
diff --git a/tests.sh b/tests.sh
new file mode 100755
index 0000000..ad46522
--- /dev/null
+++ b/tests.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+pnc="${1:-$PWD/build}/pnc"
+set -ex
+
+"$pnc" valid +33123456789
+"$pnc" valid -c US '(202) 555-0110'
+
+"$pnc" valid '(202) 555-0110' && exit 1
+
+[ "$("$pnc" format "+1 20 2 555 01 10")" = "+12025550110" ]
+[ "$("$pnc" format -c FR "0123456789")" = "+33123456789" ]
+[ "$("$pnc" format -c FR -f nat "0123456789")" = "01 23 45 67 89" ]
+[ "$("$pnc" format -f int "+12025550110")" = "+1 202-555-0110" ]
+
+[ "$("$pnc" find -c "" "+330611234345")" = "+33611234345" ]
+
+[ "$("$pnc" find -f nat "2017/04/20: You have 2 messsages, call +1-202-555-0110 to listen to them.")" = "(202) 555-0110" ]
+
+[ "$("$pnc" find -c FR "rappelle-moi au 01 23 4 56789 ou au 06 78 90 12 34 après 20h00" | head -1)" = "+33123456789" ]
+[ "$("$pnc" find -c FR "rappelle-moi au 01 23 4 56789 ou au 06 78 90 12 34 après 20h00" | tail -1)" = "+33678901234" ]
--
2.38.1
Hi,
This patch seems like it's an older revision of another patch on the mailing list.
I have marked this patch as superseded. Please reply to this email or send me a
message on irc (nick anjan) if I have made a mistake.
Thank you for your patch and work.
Sincerely,
Anjandev Momi
--
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt