diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/functional/string_spec.lua | 19 | ||||
| -rw-r--r-- | tests/mason-core/installer/registry/expr_spec.lua | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/mason-core/functional/string_spec.lua b/tests/mason-core/functional/string_spec.lua index 02062f4c..30dea069 100644 --- a/tests/mason-core/functional/string_spec.lua +++ b/tests/mason-core/functional/string_spec.lua @@ -55,7 +55,22 @@ Ipsum assert.equals("HELLO!", _.trim " HELLO! ") end) - it("trim_starts strings", function() - assert.equals("HELLO! ", _.trim_start("%s", " HELLO! ")) + it("should trim_start strings", function() + assert.equals("HELLO! ", _.trim_start_matches("%s", " HELLO! ")) + end) + + it("should trim_end strings", function() + assert.equals(" HELLO!", _.trim_end_matches("%s", " HELLO! ")) + end) + + it("should strip_prefix", function() + assert.equals("withthewind", _.strip_prefix("gone", "gonewiththewind")) + assert.equals("1.3.0", _.strip_prefix("v", "v1.3.0")) + end) + + it("should strip_suffix", function() + assert.equals("gone", _.strip_suffix("withtthewind", "gonewithtthewind")) + assert.equals("name", _.strip_suffix("%.tar%.gz", "name.tar.gz")) + assert.equals("name", _.strip_suffix(".tar.*", "name.tar.gz")) end) end) diff --git a/tests/mason-core/installer/registry/expr_spec.lua b/tests/mason-core/installer/registry/expr_spec.lua index ec92f7a7..be9de0d7 100644 --- a/tests/mason-core/installer/registry/expr_spec.lua +++ b/tests/mason-core/installer/registry/expr_spec.lua @@ -37,7 +37,7 @@ describe("registry expressions", function() assert.same( Result.success "Gloves", - expr.eval("G{{ 'Cloves' | trim_start(trim) }}", { + expr.eval("G{{ 'Cloves' | strip_prefix(trim) }}", { trim = "C", }) ) |
