aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-03-02 03:13:00 +0100
committerGitHub <noreply@github.com>2019-03-02 03:13:00 +0100
commitd44ab5fdea6dfe37edcb7da9d7c2c9929d3c299e (patch)
treef5d38c20f6d62821db78c6ba6eba0a07610d8886 /test/unit
parented4132d7e9a7a3bda21c35119ce221146493e986 (diff)
downloadrneovim-d44ab5fdea6dfe37edcb7da9d7c2c9929d3c299e.tar.gz
rneovim-d44ab5fdea6dfe37edcb7da9d7c2c9929d3c299e.tar.bz2
rneovim-d44ab5fdea6dfe37edcb7da9d7c2c9929d3c299e.zip
search.c: remove dead code #5307
has_mbyte is always true.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/search_spec.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/unit/search_spec.lua b/test/unit/search_spec.lua
new file mode 100644
index 0000000000..3c2d485e0e
--- /dev/null
+++ b/test/unit/search_spec.lua
@@ -0,0 +1,33 @@
+local helpers = require("test.unit.helpers")(after_each)
+local itp = helpers.gen_itp(it)
+
+local to_cstr = helpers.to_cstr
+local eq = helpers.eq
+
+local search = helpers.cimport("./src/nvim/search.h")
+
+itp('pat_has_uppercase', function()
+ -- works on empty string
+ eq(false, search.pat_has_uppercase(to_cstr("")))
+
+ -- works with utf uppercase
+ eq(false, search.pat_has_uppercase(to_cstr("ä")))
+ eq(true, search.pat_has_uppercase(to_cstr("Ä")))
+ eq(true, search.pat_has_uppercase(to_cstr("äaÅ")))
+
+ -- works when pat ends with backslash
+ eq(false, search.pat_has_uppercase(to_cstr("\\")))
+ eq(false, search.pat_has_uppercase(to_cstr("ab$\\")))
+
+ -- skips escaped characters
+ eq(false, search.pat_has_uppercase(to_cstr("\\Ab")))
+ eq(true, search.pat_has_uppercase(to_cstr("\\AU")))
+
+ -- skips _X escaped characters
+ eq(false, search.pat_has_uppercase(to_cstr("\\_Ab")))
+ eq(true, search.pat_has_uppercase(to_cstr("\\_AU")))
+
+ -- skips %X escaped characters
+ eq(false, search.pat_has_uppercase(to_cstr("aa\\%Ab")))
+ eq(true, search.pat_has_uppercase(to_cstr("aab\\%AU")))
+end)