From 7afdce388a7dbb7cfbd4c454e6bf79151479adbf Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Tue, 12 Nov 2024 18:10:05 -0500 Subject: [PATCH] Clean up helpers_test code --- test/helpers_test.gleam | 65 ++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/test/helpers_test.gleam b/test/helpers_test.gleam index 87f6fe0..8a14a1c 100644 --- a/test/helpers_test.gleam +++ b/test/helpers_test.gleam @@ -4,41 +4,32 @@ import startest.{describe, it} import startest/expect pub fn to_printable_text_tests() { - describe( - "should_be_printable_text", - [ - #("\t", "\\t"), - #("\n", "\\n"), - #("\r", "\\r"), - #("\f", "\\f"), - #("\r\n", "\\r\\n"), - #("\t\nabc123\r", "\\t\\nabc123\\r"), - #("abc123\r\n", "abc123\\r\\n"), - ] - |> list.map(fn(tuple) { - let #(input, output) = tuple - use <- it("\"" <> output <> "\"") - input |> to_printable_text(False) |> expect.to_equal(output) - }), - ) -} - -pub fn to_printable_text_python_tests() { - describe( - "should_be_printable_python_text", - [ - #("\t", "\\t"), - #("\n", "\\n"), - #("\r", "\\r"), - #("\f", "\\x0c"), - #("\r\n", "\\r\\n"), - #("\t\nabc123\r", "\\t\\nabc123\\r"), - #("abc123\r\n", "abc123\\r\\n"), - ] - |> list.map(fn(tuple) { - let #(input, output) = tuple - use <- it("\"" <> output <> "\"") - input |> to_printable_text(True) |> expect.to_equal(output) - }), - ) + describe("should_be_printable_text", [ + describe( + "normal_printable", + [ + #("\t", "\\t"), + #("\n", "\\n"), + #("\r", "\\r"), + #("\f", "\\f"), + #("\r\n", "\\r\\n"), + #("\t\nabc123\r", "\\t\\nabc123\\r"), + #("abc123\r\n", "abc123\\r\\n"), + ] + |> list.map(fn(tuple) { + let #(input, output) = tuple + use <- it("\"" <> output <> "\"") + input |> to_printable_text(False) |> expect.to_equal(output) + }), + ), + describe( + "python_printable", + [#("\f", "\\x0c"), #("\n\f\t", "\\n\\x0c\\t")] + |> list.map(fn(tuple) { + let #(input, output) = tuple + use <- it("\"" <> output <> "\"") + input |> to_printable_text(True) |> expect.to_equal(output) + }), + ), + ]) }