From 9d3d8ef2be15dfbf279de71241ff747a568e2c49 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 18 Jul 2025 11:51:39 +0800 Subject: Added specs, tests and docs. --- spec/outputs/string.lua | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'spec/outputs/string.lua') diff --git a/spec/outputs/string.lua b/spec/outputs/string.lua index febea62..b536e6d 100644 --- a/spec/outputs/string.lua +++ b/spec/outputs/string.lua @@ -1,3 +1,4 @@ +local _module_0 = { } local hi = "hello" local hello = "what the heckyes" print(hi) @@ -41,4 +42,42 @@ local _ = "hello"; ("hello"):format().hello(1, 2, 3); ("hello"):format(1, 2, 3) something("hello"):world() -return something(("hello"):world()) +something(("hello"):world()) +do + local str = "key: value" + str = "config:\n\tenabled: true\n\tlevel: 5" + str = "header: start\nfooter: end" + str = "name: " .. tostring(username) + str = "count: " .. tostring(total) .. " items" + str = "user: " .. tostring(name) .. "\nid: " .. tostring(id) + str = "path: \"C:\\\\Program Files\\\\App\"\ndesc: 'single \"quote\" test'" + str = "key: value \nnext: 123 " + str = "list:\n - \"one\"\n - \"two\"" + str = "-- comment\ncontent text\n-- comment" + str = tostring(1 + 2) .. '\n' .. tostring(2 + 3) .. '\n' .. tostring("a" .. "b") + local obj = { + settings = "mode: " .. tostring(mode) .. "\nflags:\n\t- " .. tostring(flag1) .. "\n\t- default" + } + local fn + fn = function() + return "Hello\nname: " .. tostring(userName) + end + str = "result:\n\tstatus: " .. tostring((function() + if ok then + return "pass" + else + return "fail" + end + end)()) .. "\n\tcode: " .. tostring(code) + local summary = "date: " .. tostring(os.date()) .. "\nvalues:\n\t-\n\t\ta: " .. tostring(aVal) .. "\n\t\tb: " .. tostring(bVal or defaultB) + local msg = send("Hello, " .. tostring(user) .. "!\nToday is " .. tostring(os.date("%A")) .. ".") + local desc + do + local prefix = "Result" + desc = tostring(prefix) .. ":\nvalue: " .. tostring(compute()) + end + print(("1\n2\n3")) +end +local yaml = "version: " .. tostring(ver) .. "\nok: true" +_module_0["yaml"] = yaml +return _module_0 -- cgit v1.2.3-55-g6feb