This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
--- @diagnostic disable: undefined-field, need-check-nil, need-check-nil
|
||||
local CodeWriter = require 'u.codewriter'
|
||||
|
||||
describe('CodeWriter', function()
|
||||
it('should write with indentation', function()
|
||||
local cw = CodeWriter.new()
|
||||
cw:write '{'
|
||||
cw:indent(function(cw2) cw2:write 'x: 123' end)
|
||||
cw:write '}'
|
||||
|
||||
assert.are.same(cw.lines, { '{', ' x: 123', '}' })
|
||||
end)
|
||||
|
||||
it('should keep relative indentation', function()
|
||||
local cw = CodeWriter.new()
|
||||
cw:write '{'
|
||||
cw:indent(function(cw2)
|
||||
cw2:write 'x: 123'
|
||||
cw2:write ' y: 123'
|
||||
end)
|
||||
cw:write '}'
|
||||
|
||||
assert.are.same(cw.lines, {
|
||||
'{',
|
||||
' x: 123',
|
||||
' y: 123',
|
||||
'}',
|
||||
})
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user