We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We're making some tests with the busted module and an empty yaml file is used in it, but the test raises an error.
busted
yaml
Just run
local yaml = require "tinyyaml" local t = yaml.parse("")
t should be an empty table.
t
lua: ./tinyyaml.lua:684: bad argument #1 to 'sfind' (string expected, got nil)
Add
if #lines == 0 then return {} end
below line 684 of tinyyaml.lua.
tinyyaml.lua
The above doesn't take into account the case of a non-empty file that has comments only. A better fix would be
if sfind(lines[1] or "", '^%%YAML') then tremove(lines, 1) end
in line 704, i.e., add or "" next to if sfind(lines[1] (suggested by @gabrielbosio).
or ""
if sfind(lines[1]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
We're making some tests with the
busted
module and an emptyyaml
file is used in it, but the test raises an error.How to reproduce this issue
Just run
Expected result
t
should be an empty table.Obtained error
Proposed fix
Add
below line 684 of
tinyyaml.lua
.Edit
The above doesn't take into account the case of a non-empty file that has comments only. A better fix would be
in line 704, i.e., add
or ""
next toif sfind(lines[1]
(suggested by @gabrielbosio).The text was updated successfully, but these errors were encountered: