From 3ff223f2a297a7300fede33dbe69da63f08e0c84 Mon Sep 17 00:00:00 2001 From: elioat Date: Sun, 9 Jun 2024 20:54:53 -0400 Subject: * --- lua/chupacabra/test_chupacabra.lua | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lua/chupacabra/test_chupacabra.lua') diff --git a/lua/chupacabra/test_chupacabra.lua b/lua/chupacabra/test_chupacabra.lua index 0a06124..5cf04e0 100644 --- a/lua/chupacabra/test_chupacabra.lua +++ b/lua/chupacabra/test_chupacabra.lua @@ -1,22 +1,10 @@ local chupacabra = require("chupacabra") -local function table_to_string(t) - local str = "[" - for i, v in ipairs(t) do - if i > 1 then - str = str .. " " - end - str = str .. tostring(v) - end - str = str .. "]" - return str -end - -- test cases local function tc(input, expected_output) local output = chupacabra.run(input, {}) - local expected_output_str = type(expected_output) == "table" and table_to_string(expected_output) or tostring(expected_output) - local output_str = type(output) == "table" and table_to_string(output) or tostring(output) + local expected_output_str = type(expected_output) == "table" and chupacabra.table_to_string(expected_output) or tostring(expected_output) + local output_str = type(output) == "table" and chupacabra.table_to_string(output) or tostring(output) assert(output_str == expected_output_str, "Test failed: " .. input .. " => " .. output_str .. ", expected: " .. expected_output_str) print("Test passed: " .. input .. " => " .. output_str) end -- cgit 1.4.1-2-gfad0