diff --git a/spec/emptylines_spec.lua b/spec/emptylines_spec.lua new file mode 100644 index 0000000..cc2c8b0 --- /dev/null +++ b/spec/emptylines_spec.lua @@ -0,0 +1,41 @@ +local busted = require 'busted' +local assert = require 'luassert' +local yaml = require 'tinyyaml' + +busted.describe("empty lines", function() + busted.it("multi-line scalar", function() + assert.same( + { + abstract = "This is the abstract.\nIt consists of two paragraphs.\n" + }, + yaml.parse([[ + abstract: | + This is the abstract. + It consists of two paragraphs. + ]]) + ) + assert.same( + { + abstract = "This is the abstract.\n\nIt consists of two paragraphs.\n" + }, + yaml.parse([[ + abstract: | + This is the abstract. + + It consists of two paragraphs. + ]]) + ) + assert.same( + { + abstract = "This is the abstract.\n\n\nIt consists of two paragraphs.\n" + }, + yaml.parse([[ + abstract: | + This is the abstract. + + + It consists of two paragraphs. + ]]) + ) + end) +end)