summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2021-08-08 09:50:55 (GMT)
committerGitHub <noreply@github.com>2021-08-08 09:50:55 (GMT)
commiteb70459803b8ea1d879c011ed5c8f5d5c16d250b (patch)
tree85c7bf0235ef3c771fe384e3030da66d0d896f9f /tests
parentde45d6e0fa59e1c5dc21f611dd73f91ba04aaff1 (diff)
parente2561f20e6919a94d0be697db16fb6a3f4602b38 (diff)
downloadlz4-eb70459803b8ea1d879c011ed5c8f5d5c16d250b.zip
lz4-eb70459803b8ea1d879c011ed5c8f5d5c16d250b.tar.gz
lz4-eb70459803b8ea1d879c011ed5c8f5d5c16d250b.tar.bz2
Merge pull request #1019 from servusdei2018/patch-1
nit(programs/platform.h): replace Unicode character #1018
Diffstat (limited to 'tests')
-rw-r--r--tests/unicode_lint.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/unicode_lint.sh b/tests/unicode_lint.sh
new file mode 100644
index 0000000..969fcc5
--- /dev/null
+++ b/tests/unicode_lint.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# `unicode_lint.sh' determines whether source files under the ./lib/ and ./programs/ directories
+# contain Unicode characters, and fails if any do.
+#
+# See https://github.com/lz4/lz4/issues/1018
+
+pass=true
+
+# Scan ./lib/ for Unicode in source (*.c, *.h) files
+result=$(
+ find ./lib/ -regex '.*\.\(c\|h\)$' -exec grep -P -n "[^\x00-\x7F]" {} \; -exec echo "{}: FAIL" \;
+)
+if [[ $result ]]; then
+ echo "$result"
+ pass=false
+fi
+
+# Scan ./programs/ for Unicode in source (*.c, *.h) files
+result=$(
+ find ./programs/ -regex '.*\.\(c\|h\)$' -exec grep -P -n "[^\x00-\x7F]" {} \; -exec echo "{}: FAIL" \;
+)
+if [[ $result ]]; then
+ echo "$result"
+ pass=false
+fi
+
+if [ "$pass" = true ]; then
+ echo "All tests successful."
+ echo "Result: PASS"
+ exit 0
+else
+ echo "Result: FAIL"
+ exit 1
+fi