~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH pnc v2] CMake: Integrate tests from Alpine APKBUILD

Details
Message ID
<20221108231713.31611-1-jamipkettunen@gmail.com>
DKIM signature
missing
Download raw message
Patch: +27 -0
We should be testing the built tool everywhere, this also shrinks the
APKBUILD by quite a bit :)
---
Changes since v1:
- Fix whitespace issue and move test stuff to a more place in
  CMakeLists.txt

 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..ba51acb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,13 @@ target_link_libraries(
	${LIBGEOCODING}
)

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)

install(
	TARGETS pnc
	RUNTIME DESTINATION bin
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
Details
Message ID
<COBJMWIWRDAE.2KW8S77QW3HGV@navi>
In-Reply-To
<20221108231713.31611-1-jamipkettunen@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git@git.sr.ht:~anjan/pnc
   8ba9b52..a521d7c  master -> master
--
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
Reply to thread Export thread (mbox)