diff options
| author | Carlo Landmeter <clandmeter@gmail.com> | 2017-06-14 12:02:34 +0200 |
|---|---|---|
| committer | Carlo Landmeter <clandmeter@gmail.com> | 2017-06-14 12:02:57 +0200 |
| commit | 85ce82b389e5d418380b85731152da07155cf0b2 (patch) | |
| tree | 3a37873a0d80ded3c07dc8d5d44c5aa05972a5f5 /community/lua-toml/fix-decode-arrays-and-include-testcase.patch | |
| parent | cad5581a14cb3580b186149e043b92fb49cb73a0 (diff) | |
| download | aports-85ce82b389e5d418380b85731152da07155cf0b2.tar.bz2 aports-85ce82b389e5d418380b85731152da07155cf0b2.tar.xz | |
community/lua-toml: fix decode arrays and include testcase
https://github.com/jonstoler/lua-toml/pull/13
Diffstat (limited to 'community/lua-toml/fix-decode-arrays-and-include-testcase.patch')
| -rw-r--r-- | community/lua-toml/fix-decode-arrays-and-include-testcase.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/community/lua-toml/fix-decode-arrays-and-include-testcase.patch b/community/lua-toml/fix-decode-arrays-and-include-testcase.patch new file mode 100644 index 0000000000..0409f39ee1 --- /dev/null +++ b/community/lua-toml/fix-decode-arrays-and-include-testcase.patch @@ -0,0 +1,50 @@ +From d77cbb5f94bb8fbaa8d589573de20ce120765055 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 14 Jun 2017 11:23:32 +0200 +Subject: [PATCH 1/2] add test case for issue #12 + +--- + spec/encode_spec.lua | 11 +++++++++++ + 1 file changed, 11 insertions(+) + create mode 100644 spec/encode_spec.lua + +diff --git a/spec/encode_spec.lua b/spec/encode_spec.lua +new file mode 100644 +index 0000000..db26834 +--- /dev/null ++++ b/spec/encode_spec.lua +@@ -0,0 +1,11 @@ ++describe("encoding", function() ++ setup(function() ++ TOML = require "toml" ++ end) ++ ++ it("array", function() ++ local obj = TOML.encode{ a = { "foo","bar" } } ++ local sol = "a = [\nfoo,\nbar,\n]" ++ assert.same(sol, obj) ++ end) ++end) + +From b914f26b66856d82d11d4c9205d5ccd97ae54bb6 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 14 Jun 2017 11:44:20 +0200 +Subject: [PATCH 2/2] fix encoding of plain ol borring arrays (issue #12) + +--- + toml.lua | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/toml.lua b/toml.lua +index a5655ed..b5eb2ed 100644 +--- a/toml.lua ++++ b/toml.lua +@@ -619,7 +619,7 @@ TOML.encode = function(tbl) + else + -- plain ol boring array + toml = toml .. k .. " = [\n" +- for kk, vv in pairs(v) do ++ for kk, vv in pairs(first) do + toml = toml .. tostring(vv) .. ",\n" + end + toml = toml .. "]\n" |
