describe "yaml string", -> it "should create basic yaml string", -> s = | hello world assert.is_true s\match("hello")? assert.is_true s\match("world")? it "should preserve indentation", -> s = | key1: value1 key2: value2 assert.is_true s\match("key1")? assert.is_true s\match("key2")? it "should support interpolation", -> name = "test" s = | hello #{name} assert.same s, "hello test" it "should handle complex interpolation", -> x, y = 10, 20 s = | point: x: #{x} y: #{y} assert.is_true s\match("x: 10")? assert.is_true s\match("y: 20")? it "should work with expressions", -> s = | result: #{1 + 2} assert.is_true s\match("result: 3")? it "should support multiline with variables", -> config = | database: host: localhost port: 5432 name: mydb assert.is_true config\match("database:")? assert.is_true config\match("host:")? it "should escape special characters", -> Hello = "Hello" s = | path: "C:\Program Files\App" note: 'He said: "#{Hello}!"' assert.same s, [[ path: "C:\Program Files\App" note: 'He said: "Hello!"']] it "should work in function", -> fn = -> str = | foo: bar: baz return str result = fn! assert.same result, "foo:\n\tbar: baz" it "should strip common leading whitespace", -> fn = -> s = | nested: item: value s result = fn! assert.same result, "nested: item: value" it "should support empty lines", -> s = | line1 line3 assert.same s, "line1\nline3" it "should work with table access in interpolation", -> t = {value: 100} s = | value: #{t.value} assert.same s, "value: 100" it "should support function calls in interpolation", -> s = | result: #{(-> 42)!} assert.same s, "result: 42" it "should handle quotes correctly", -> s = | "quoted" 'single quoted' assert.is_true s\match('"quoted"')? assert.is_true s\match("'single quoted'")? it "should work with multiple interpolations", -> a, b, c = 1, 2, 3 s = | values: #{a}, #{b}, #{c} assert.same s, "values: 1, 2, 3" it "should preserve newlines", -> s = | first line second line third line lines = [line for line in s\gmatch "[^\n]+"] assert.same #lines, 3