aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gleam/string_test.gleam36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/gleam/string_test.gleam b/test/gleam/string_test.gleam
index d08ea78..93de5db 100644
--- a/test/gleam/string_test.gleam
+++ b/test/gleam/string_test.gleam
@@ -185,3 +185,39 @@ pub fn slice_test() {
|> string.slice(at_index: -12, length: 2)
|> should.equal("")
}
+
+pub fn pad_left_test() {
+ "121"
+ |> string.pad_left(to: 5, with: ".")
+ |> should.equal("..121")
+
+ "121"
+ |> string.pad_left(to: 3, with: ".")
+ |> should.equal("121")
+
+ "121"
+ |> string.pad_left(to: 2, with: ".")
+ |> should.equal("121")
+
+ "121"
+ |> string.pad_left(to: 5, with: "XY")
+ |> should.equal("XYXY121")
+}
+
+pub fn pad_right_test() {
+ "121"
+ |> string.pad_right(to: 5, with: ".")
+ |> should.equal("121..")
+
+ "121"
+ |> string.pad_right(to: 3, with: ".")
+ |> should.equal("121")
+
+ "121"
+ |> string.pad_right(to: 2, with: ".")
+ |> should.equal("121")
+
+ "121"
+ |> string.pad_right(to: 5, with: "XY")
+ |> should.equal("121XYXY")
+}