aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/functional/string_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/functional/string_spec.lua')
-rw-r--r--tests/core/functional/string_spec.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/core/functional/string_spec.lua b/tests/core/functional/string_spec.lua
new file mode 100644
index 00000000..53575ce4
--- /dev/null
+++ b/tests/core/functional/string_spec.lua
@@ -0,0 +1,17 @@
+local _ = require "nvim-lsp-installer.core.functional"
+
+describe("functional: string", function()
+ it("matches string patterns", function()
+ assert.is_true(_.matches("foo", "foo"))
+ assert.is_true(_.matches("bar", "foobarbaz"))
+ assert.is_true(_.matches("ba+r", "foobaaaaaaarbaz"))
+
+ assert.is_false(_.matches("ba+r", "foobharbaz"))
+ assert.is_false(_.matches("bar", "foobaz"))
+ end)
+
+ it("should format strings", function()
+ assert.equals("Hello World!", _.format("%s", "Hello World!"))
+ assert.equals("special manouvers", _.format("%s manouvers", "special"))
+ end)
+end)