diff options
| author | William Boman <william@redwill.se> | 2022-12-26 16:50:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-26 16:50:40 +0100 |
| commit | 05ea35e25dcb03fc019be9ec0ede7e4782bae6b4 (patch) | |
| tree | 2458ad78bddd6f69a348d8381119bc7bc6667142 /tests/mason-core/functional | |
| parent | refactor(installer): introduce PackageInstallOpts class (#802) (diff) | |
| download | mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar.gz mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar.bz2 mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar.lz mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar.xz mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.tar.zst mason-05ea35e25dcb03fc019be9ec0ede7e4782bae6b4.zip | |
feat(functional): add strip_{prefix,suffix} (#803)
Diffstat (limited to 'tests/mason-core/functional')
| -rw-r--r-- | tests/mason-core/functional/string_spec.lua | 19 |
1 files changed, 17 insertions, 2 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) |
