diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2022-03-19 17:42:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-19 17:42:53 +0300 |
| commit | a36818d3f3afd8758ec10991a5cb08ebdaca6329 (patch) | |
| tree | 445c27832ac4fb48a03c146fa7c797dc4880c099 /test/ltn12test.lua | |
| parent | 6952262e6a1315b14935ddd0ea511c202c0154ba (diff) | |
| parent | 8390d07774a1ba1a597d809a1a2562d88ecce19d (diff) | |
| download | luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.gz luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.bz2 luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.zip | |
Merge pull request #354 from lunarmodules/linter
Diffstat (limited to 'test/ltn12test.lua')
| -rw-r--r-- | test/ltn12test.lua | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/ltn12test.lua b/test/ltn12test.lua index e7d368d..0cafbc9 100644 --- a/test/ltn12test.lua +++ b/test/ltn12test.lua | |||
| @@ -38,7 +38,7 @@ local function named(f, name) | |||
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | -------------------------------- | 40 | -------------------------------- |
| 41 | local function split(size) | 41 | local function split(size) |
| 42 | local buffer = "" | 42 | local buffer = "" |
| 43 | local last_out = "" | 43 | local last_out = "" |
| 44 | local last_in = "" | 44 | local last_in = "" |
| @@ -50,12 +50,12 @@ local function split(size) | |||
| 50 | return last_out | 50 | return last_out |
| 51 | end | 51 | end |
| 52 | return function(chunk, done) | 52 | return function(chunk, done) |
| 53 | if done then | 53 | if done then |
| 54 | return not last_in and not last_out | 54 | return not last_in and not last_out |
| 55 | end | 55 | end |
| 56 | -- check if argument is consistent with state | 56 | -- check if argument is consistent with state |
| 57 | if not chunk then | 57 | if not chunk then |
| 58 | if last_in and last_in ~= "" and last_out ~= "" then | 58 | if last_in and last_in ~= "" and last_out ~= "" then |
| 59 | error("nil chunk following data chunk", 2) | 59 | error("nil chunk following data chunk", 2) |
| 60 | end | 60 | end |
| 61 | if not last_out then error("extra nil chunk", 2) end | 61 | if not last_out then error("extra nil chunk", 2) end |
| @@ -67,8 +67,8 @@ local function split(size) | |||
| 67 | return output(chunk) | 67 | return output(chunk) |
| 68 | else | 68 | else |
| 69 | if not last_in then error("data chunk following nil chunk", 2) end | 69 | if not last_in then error("data chunk following nil chunk", 2) end |
| 70 | if last_in ~= "" and last_out ~= "" then | 70 | if last_in ~= "" and last_out ~= "" then |
| 71 | error("data chunk following data chunk", 2) | 71 | error("data chunk following data chunk", 2) |
| 72 | end | 72 | end |
| 73 | buffer = chunk | 73 | buffer = chunk |
| 74 | return output(chunk) | 74 | return output(chunk) |
| @@ -85,7 +85,7 @@ local function format(chunk) | |||
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | -------------------------------- | 87 | -------------------------------- |
| 88 | local function merge(size) | 88 | local function merge(size) |
| 89 | local buffer = "" | 89 | local buffer = "" |
| 90 | local last_out = "" | 90 | local last_out = "" |
| 91 | local last_in = "" | 91 | local last_in = "" |
| @@ -102,12 +102,12 @@ local function merge(size) | |||
| 102 | return last_out | 102 | return last_out |
| 103 | end | 103 | end |
| 104 | return function(chunk, done) | 104 | return function(chunk, done) |
| 105 | if done then | 105 | if done then |
| 106 | return not last_in and not last_out | 106 | return not last_in and not last_out |
| 107 | end | 107 | end |
| 108 | -- check if argument is consistent with state | 108 | -- check if argument is consistent with state |
| 109 | if not chunk then | 109 | if not chunk then |
| 110 | if last_in and last_in ~= "" and last_out ~= "" then | 110 | if last_in and last_in ~= "" and last_out ~= "" then |
| 111 | error("nil chunk following data chunk", 2) | 111 | error("nil chunk following data chunk", 2) |
| 112 | end | 112 | end |
| 113 | if not last_out then error("extra nil chunk", 2) end | 113 | if not last_out then error("extra nil chunk", 2) end |
| @@ -119,8 +119,8 @@ local function merge(size) | |||
| 119 | return output(chunk) | 119 | return output(chunk) |
| 120 | else | 120 | else |
| 121 | if not last_in then error("data chunk following nil chunk", 2) end | 121 | if not last_in then error("data chunk following nil chunk", 2) end |
| 122 | if last_in ~= "" and last_out ~= "" then | 122 | if last_in ~= "" and last_out ~= "" then |
| 123 | error("data chunk following data chunk", 2) | 123 | error("data chunk following data chunk", 2) |
| 124 | end | 124 | end |
| 125 | buffer = buffer .. chunk | 125 | buffer = buffer .. chunk |
| 126 | return output(chunk) | 126 | return output(chunk) |
