From e7db4df984ba8f6bf6dfeb43653eaf70f3c4fc81 Mon Sep 17 00:00:00 2001 From: perro Date: Tue, 14 Mar 2023 14:46:51 -0700 Subject: [PATCH] Tests ready --- tests/fail.lit.complex.md | 12 +++---- tests/fail.lit.simple.md | 18 +++++----- tests/pass.lit.complex.md | 36 ++++++++++--------- tests/pass.lit.complex.md.json | 1 + tests/pass.lit.ignored.md | 16 ++++----- tests/pass.lit.ignored.md.json | 1 + tests/pass.lit.simple.md | 66 +++++++++++++++++----------------- tests/pass.lit.simple.md.json | 1 + tests/pass.lit.warns.md | 4 +-- tests/pass.lit.warns.md.json | 1 + 10 files changed, 82 insertions(+), 74 deletions(-) create mode 100644 tests/pass.lit.complex.md.json create mode 100644 tests/pass.lit.ignored.md.json create mode 100644 tests/pass.lit.simple.md.json create mode 100644 tests/pass.lit.warns.md.json diff --git a/tests/fail.lit.complex.md b/tests/fail.lit.complex.md index f10d637..70b8fae 100644 --- a/tests/fail.lit.complex.md +++ b/tests/fail.lit.complex.md @@ -13,11 +13,11 @@ # Invalid Calls -* fn1(1, $stdout: "true") has invalid rkwarg value -* fn1(1, $act: "return") has invalid rkwarg -* fn1(1, $eval: "/path/does/not/exists") has invalid path -* fn1(1, $code: "/path/does/not/exists") has invalid path -* fn1(1, $lua: "/path/does/not/exists") has invalid path -* fn1(fn4()); `fn4()` is not declared +- fn1(1, $stdout: "true") has invalid rkwarg value +- fn1(1, $act: "return") has invalid rkwarg +- fn1(1, $eval: "/path/does/not/exists") has invalid path +- fn1(1, $code: "/path/does/not/exists") has invalid path +- fn1(1, $lua: "/path/does/not/exists") has invalid path +- fn1(fn4()); `fn4()` is not declared Invalid calls and declarations generate and collects errors. diff --git a/tests/fail.lit.simple.md b/tests/fail.lit.simple.md index 17b3294..79ef0db 100644 --- a/tests/fail.lit.simple.md +++ b/tests/fail.lit.simple.md @@ -25,14 +25,14 @@ # Invalid Calls -* fn1(1) adds arg -* fn1( never end -* fn1(invalid arg) -* fn2() misses arg -* fn2(a: 3) wrong kwarg -* fn3(1 2) misses separator -* fn3(1, 2, 3) wrong args number -* fn3(1, b: 2) mixed arg and kwarg -* fn4() fn5() not declared +- fn1(1) adds arg +- fn1( never end +- fn1(invalid arg) +- fn2() misses arg +- fn2(a: 3) wrong kwarg +- fn3(1 2) misses separator +- fn3(1, 2, 3) wrong args number +- fn3(1, b: 2) mixed arg and kwarg +- fn4() fn5() not declared Invalid calls and declarations generate and collects errors. diff --git a/tests/pass.lit.complex.md b/tests/pass.lit.complex.md index 3c96619..986d802 100644 --- a/tests/pass.lit.complex.md +++ b/tests/pass.lit.complex.md @@ -28,19 +28,23 @@ Valid calls: -* fn1($stdout: true) gets stdout instead of evaluation result. -* fn1($action: "wipe") wipes calls and declarations of this function from source document after all calls. -* fn2($action: "return") returns result after call. -* fn2($action: "hide") hides call from source document after call. -* fn2($action: "quote") quotes it without call. -* fn2($eval: "fn2.txt", $code: "fn2.fnl", $lua: "fn2.lua") writes evaluation results, Fennel code and Lua code. -* fn3(4, $action: "return") has arg and rkwarg. -* fn3($action: "return", 5) has rkwarg and arg. -* fn3($eval: "fn3-4.txt", $code: "fn3-4.fnl", $lua: "fn3-4.lua") writes in same files than below. -* fn4(a: 1, b: 2, $action: "return") has kwargs and rkwarg. -* fn4($action: "return", a: 1, b: 2) has rkwarg and kwargs. -* fn4(a: 1, $action: "return", b: 2) has kwarg, rkwarg and kwarg. -* fn4($eval: "fn3-4.txt", $code: "fn3-4.fnl", $lua: "fn3-4.lua") writes in same files than above. -* fn5(10) calls another function inside. -* fn6(9, 8) calls another quoted function inside. -* fn7(fn7(1)) calls several functions. +- fn1($stdout: true) gets stdout instead of evaluation result. +- fn1($action: "wipe") wipes calls and declarations of this function from + source document after all calls. +- fn2($action: "return") returns result after call. +- fn2($action: "hide") hides call from source document after call. +- fn2($action: "quote") quotes it without call. +- fn2($eval: "fn2.txt", $code: "fn2.fnl", $lua: "fn2.lua") writes + evaluation results, Fennel code and Lua code. +- fn3(4, $action: "return") has arg and rkwarg. +- fn3($action: "return", 5) has rkwarg and arg. +- fn3($eval: "fn3-4.txt", $code: "fn3-4.fnl", $lua: "fn3-4.lua") writes in + same files than below. +- fn4(a: 1, b: 2, $action: "return") has kwargs and rkwarg. +- fn4($action: "return", a: 1, b: 2) has rkwarg and kwargs. +- fn4(a: 1, $action: "return", b: 2) has kwarg, rkwarg and kwarg. +- fn4($eval: "fn3-4.txt", $code: "fn3-4.fnl", $lua: "fn3-4.lua") writes in + same files than above. +- fn5(10) calls another function inside. +- fn6(9, 8) calls another quoted function inside. +- fn7(fn7(1)) calls several functions. diff --git a/tests/pass.lit.complex.md.json b/tests/pass.lit.complex.md.json new file mode 100644 index 0000000..b8d2f68 --- /dev/null +++ b/tests/pass.lit.complex.md.json @@ -0,0 +1 @@ +{"pandoc-api-version":[1,23],"meta":{},"blocks":[{"t":"Header","c":[1,["declarations",[],[]],[{"t":"Str","c":"Declarations"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- fn1()\nprint(\"I am in stdout\")\n\"Wipes it\"\n\n-- fn2()\n1 + 2 + 3\n\n-- fn3(n)\n#n .. \" \" .. #n\n\n-- fn4(a, b)\n#a * #b"]},{"t":"Header","c":[1,["recursive-declarations",[],[]],[{"t":"Str","c":"Recursive"},{"t":"Space"},{"t":"Str","c":"Declarations"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- fn5(x)\n#fn2() * x\n\n-- fn6(y, z)\n#y + #fn2($action: \"quote\") + #z\n\n-- fn7(a) \n#a + #fn4(#a, #fn2())"]},{"t":"Header","c":[1,["calls",[],[]],[{"t":"Str","c":"Calls"}]]},{"t":"Para","c":[{"t":"Str","c":"Valid"},{"t":"Space"},{"t":"Str","c":"calls:"}]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"Str","c":"fn1($stdout:"},{"t":"Space"},{"t":"Str","c":"true)"},{"t":"Space"},{"t":"Str","c":"gets"},{"t":"Space"},{"t":"Str","c":"stdout"},{"t":"Space"},{"t":"Str","c":"instead"},{"t":"Space"},{"t":"Str","c":"of"},{"t":"Space"},{"t":"Str","c":"evaluation"},{"t":"Space"},{"t":"Str","c":"result."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn1($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"wipe"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"wipes"},{"t":"Space"},{"t":"Str","c":"calls"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"declarations"},{"t":"Space"},{"t":"Str","c":"of"},{"t":"Space"},{"t":"Str","c":"this"},{"t":"Space"},{"t":"Str","c":"function"},{"t":"Space"},{"t":"Str","c":"from"},{"t":"SoftBreak"},{"t":"Str","c":"source"},{"t":"Space"},{"t":"Str","c":"document"},{"t":"Space"},{"t":"Str","c":"after"},{"t":"Space"},{"t":"Str","c":"all"},{"t":"Space"},{"t":"Str","c":"calls."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"returns"},{"t":"Space"},{"t":"Str","c":"result"},{"t":"Space"},{"t":"Str","c":"after"},{"t":"Space"},{"t":"Str","c":"call."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"hide"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"hides"},{"t":"Space"},{"t":"Str","c":"call"},{"t":"Space"},{"t":"Str","c":"from"},{"t":"Space"},{"t":"Str","c":"source"},{"t":"Space"},{"t":"Str","c":"document"},{"t":"Space"},{"t":"Str","c":"after"},{"t":"Space"},{"t":"Str","c":"call."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"quote"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"quotes"},{"t":"Space"},{"t":"Str","c":"it"},{"t":"Space"},{"t":"Str","c":"without"},{"t":"Space"},{"t":"Str","c":"call."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2($eval:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn2.txt"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$code:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn2.fnl"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$lua:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn2.lua"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"writes"},{"t":"SoftBreak"},{"t":"Str","c":"evaluation"},{"t":"Space"},{"t":"Str","c":"results,"},{"t":"Space"},{"t":"Str","c":"Fennel"},{"t":"Space"},{"t":"Str","c":"code"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"Lua"},{"t":"Space"},{"t":"Str","c":"code."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3(4,"},{"t":"Space"},{"t":"Str","c":"$action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"has"},{"t":"Space"},{"t":"Str","c":"arg"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"rkwarg."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"5)"},{"t":"Space"},{"t":"Str","c":"has"},{"t":"Space"},{"t":"Str","c":"rkwarg"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"arg."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3($eval:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.txt"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$code:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.fnl"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$lua:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.lua"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"writes"},{"t":"Space"},{"t":"Str","c":"in"},{"t":"SoftBreak"},{"t":"Str","c":"same"},{"t":"Space"},{"t":"Str","c":"files"},{"t":"Space"},{"t":"Str","c":"than"},{"t":"Space"},{"t":"Str","c":"below."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4(a:"},{"t":"Space"},{"t":"Str","c":"1,"},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"2,"},{"t":"Space"},{"t":"Str","c":"$action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"has"},{"t":"Space"},{"t":"Str","c":"kwargs"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"rkwarg."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4($action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"1,"},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"2)"},{"t":"Space"},{"t":"Str","c":"has"},{"t":"Space"},{"t":"Str","c":"rkwarg"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"kwargs."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4(a:"},{"t":"Space"},{"t":"Str","c":"1,"},{"t":"Space"},{"t":"Str","c":"$action:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"return"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"2)"},{"t":"Space"},{"t":"Str","c":"has"},{"t":"Space"},{"t":"Str","c":"kwarg,"},{"t":"Space"},{"t":"Str","c":"rkwarg"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"kwarg."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4($eval:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.txt"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$code:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.fnl"}]]},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"$lua:"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"fn3-4.lua"}]]},{"t":"Str","c":")"},{"t":"Space"},{"t":"Str","c":"writes"},{"t":"Space"},{"t":"Str","c":"in"},{"t":"SoftBreak"},{"t":"Str","c":"same"},{"t":"Space"},{"t":"Str","c":"files"},{"t":"Space"},{"t":"Str","c":"than"},{"t":"Space"},{"t":"Str","c":"above."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn5(10)"},{"t":"Space"},{"t":"Str","c":"calls"},{"t":"Space"},{"t":"Str","c":"another"},{"t":"Space"},{"t":"Str","c":"function"},{"t":"Space"},{"t":"Str","c":"inside."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn6(9,"},{"t":"Space"},{"t":"Str","c":"8)"},{"t":"Space"},{"t":"Str","c":"calls"},{"t":"Space"},{"t":"Str","c":"another"},{"t":"Space"},{"t":"Str","c":"quoted"},{"t":"Space"},{"t":"Str","c":"function"},{"t":"Space"},{"t":"Str","c":"inside."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn7(fn7(1))"},{"t":"Space"},{"t":"Str","c":"calls"},{"t":"Space"},{"t":"Str","c":"several"},{"t":"Space"},{"t":"Str","c":"functions."}]}]]}]} diff --git a/tests/pass.lit.ignored.md b/tests/pass.lit.ignored.md index f90b0e3..c999285 100644 --- a/tests/pass.lit.ignored.md +++ b/tests/pass.lit.ignored.md @@ -1,6 +1,6 @@ # Not declarations - -- doesn't starts with `%a`: \fn1() + -- skipped: \fn1() 1 + 2 -- doesn't starts with `%a` because of the space: fn 2() @@ -20,10 +20,10 @@ # Not calls -* \fn1() doesn't starts with `%a` -* fn 2() doesn't starts with `%a` because of the space -* fn-3() doesn't continue with `%w` -* fn4 () space before `(` -* fn5) misses `(` -* fn6 misses `()` -* `fn1()` as inline code +- \fn1() skipped +- fn 2() doesn't starts with `%a` because of the space +- fn-3() doesn't continue with `%w` +- fn4 () space before `(` +- fn5) misses `(` +- fn6 misses `()` +- `fn1()` as inline code diff --git a/tests/pass.lit.ignored.md.json b/tests/pass.lit.ignored.md.json new file mode 100644 index 0000000..dd0674d --- /dev/null +++ b/tests/pass.lit.ignored.md.json @@ -0,0 +1 @@ +{"pandoc-api-version":[1,23],"meta":{},"blocks":[{"t":"Header","c":[1,["not-declarations",[],[]],[{"t":"Str","c":"Not"},{"t":"Space"},{"t":"Str","c":"declarations"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- skipped: \\fn1()\n1 + 2\n\n-- doesn't starts with `%a` because of the space: fn 2()\n1 + 2\n\n-- doesn't continue with `%w`: fn-3()\n1 + 2\n\n-- space before `(`: fn4 ()\n1 + 2\n\n-- misses `(`: fn5) \n1 + 2\n\n-- misses `()`: fn6 \n1 + 2"]},{"t":"Header","c":[1,["not-calls",[],[]],[{"t":"Str","c":"Not"},{"t":"Space"},{"t":"Str","c":"calls"}]]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"RawInline","c":["tex","\\fn1"]},{"t":"Str","c":"()"},{"t":"Space"},{"t":"Str","c":"skipped"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn"},{"t":"Space"},{"t":"Str","c":"2()"},{"t":"Space"},{"t":"Str","c":"doesn’t"},{"t":"Space"},{"t":"Str","c":"starts"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"%a"]},{"t":"Space"},{"t":"Str","c":"because"},{"t":"Space"},{"t":"Str","c":"of"},{"t":"Space"},{"t":"Str","c":"the"},{"t":"Space"},{"t":"Str","c":"space"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn-3()"},{"t":"Space"},{"t":"Str","c":"doesn’t"},{"t":"Space"},{"t":"Str","c":"continue"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"%w"]}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4"},{"t":"Space"},{"t":"Str","c":"()"},{"t":"Space"},{"t":"Str","c":"space"},{"t":"Space"},{"t":"Str","c":"before"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"("]}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn5)"},{"t":"Space"},{"t":"Str","c":"misses"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"("]}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn6"},{"t":"Space"},{"t":"Str","c":"misses"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"()"]}]}],[{"t":"Plain","c":[{"t":"Code","c":[["",[],[]],"fn1()"]},{"t":"Space"},{"t":"Str","c":"as"},{"t":"Space"},{"t":"Str","c":"inline"},{"t":"Space"},{"t":"Str","c":"code"}]}]]}]} diff --git a/tests/pass.lit.simple.md b/tests/pass.lit.simple.md index 5f9f2df..0b48e2f 100644 --- a/tests/pass.lit.simple.md +++ b/tests/pass.lit.simple.md @@ -1,13 +1,13 @@ # Calls Before Declarations -* A common call: fn1(). All calls results should be print on `--verbose`. -* fn1() another common call. -* fn1() -* Two calls: fn1() and fn1(). -* Two consecutive calls: fn1() fn1(). -* A call with one arg: fn2(1). -* A call with two args: fn3(2, 3). -* A call with args as kwargs: fn2(n: 2) and fn3(b: 4, a: 5). +- A common call: fn1(). All calls results should be print on `--verbose`. +- fn1() another common call. +- fn1() +- Two calls: fn1() and fn1(). +- Two consecutive calls: fn1() fn1(). +- A call with one arg: fn2(1). +- A call with two args: fn3(2, 3). +- A call with args as kwargs: fn2(n: 2) and fn3(b: 4, a: 5). # Declarations @@ -18,7 +18,7 @@ A declaration: All declarations should be print on `--verbose`. -A declaration with one arg: +A declaration with one arg: -- Also valid, Lua is the default: fn2(n) #n .. " " .. #n @@ -40,30 +40,30 @@ A declaration with arg and scaped: # Calls and Data Types -* fn2(3); integer -* fn2(1_000); integer with separator -* fn4(1.0); float -* fn5("str"); string -* fn5(true) -* fn5(false) -* fn2([]); empty array / list / sequential table -* fn2([0, 1]); array / list / sequential table -* fn2({}); empty dict / table -* fn2({"k1": 1, "k2": 2}); dict / table +- fn2(3); integer +- fn2(1_000); integer with separator +- fn4(1.0); float +- fn5("str"); string +- fn5(true) +- fn5(false) +- fn2([]); empty array / list / sequential table +- fn2([0, 1]); array / list / sequential table +- fn2({}); empty dict / table +- fn2({"k1": 1, "k2": 2}); dict / table # Messy Calls -* fn1( ) -* fn2( 4) -* fn2(5 ) -* fn2( 6 ) -* fn2( n: 7) -* fn2(n: 8 ) -* fn2( n: 9 ) -* fn2(n:10) -* fn3( a: 6, b: 7) -* fn3( a: 8 , b: 9) -* fn3( a: 10 , b: 11) -* fn3( a: 12 , b: 13) -* fn3( a: 14 , b: 15 ) -* fn3(a:16,b:17) +- fn1( ) +- fn2( 4) +- fn2(5 ) +- fn2( 6 ) +- fn2( n: 7) +- fn2(n: 8 ) +- fn2( n: 9 ) +- fn2(n:10) +- fn3( a: 6, b: 7) +- fn3( a: 8 , b: 9) +- fn3( a: 10 , b: 11) +- fn3( a: 12 , b: 13) +- fn3( a: 14 , b: 15 ) +- fn3(a:16,b:17) diff --git a/tests/pass.lit.simple.md.json b/tests/pass.lit.simple.md.json new file mode 100644 index 0000000..4348353 --- /dev/null +++ b/tests/pass.lit.simple.md.json @@ -0,0 +1 @@ +{"pandoc-api-version":[1,23],"meta":{},"blocks":[{"t":"Header","c":[1,["calls-before-declarations",[],[]],[{"t":"Str","c":"Calls"},{"t":"Space"},{"t":"Str","c":"Before"},{"t":"Space"},{"t":"Str","c":"Declarations"}]]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"common"},{"t":"Space"},{"t":"Str","c":"call:"},{"t":"Space"},{"t":"Str","c":"fn1()."},{"t":"Space"},{"t":"Str","c":"All"},{"t":"Space"},{"t":"Str","c":"calls"},{"t":"Space"},{"t":"Str","c":"results"},{"t":"Space"},{"t":"Str","c":"should"},{"t":"Space"},{"t":"Str","c":"be"},{"t":"Space"},{"t":"Str","c":"print"},{"t":"Space"},{"t":"Str","c":"on"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"--verbose"]},{"t":"Str","c":"."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn1()"},{"t":"Space"},{"t":"Str","c":"another"},{"t":"Space"},{"t":"Str","c":"common"},{"t":"Space"},{"t":"Str","c":"call."}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn1()"}]}],[{"t":"Plain","c":[{"t":"Str","c":"Two"},{"t":"Space"},{"t":"Str","c":"calls:"},{"t":"Space"},{"t":"Str","c":"fn1()"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"fn1()."}]}],[{"t":"Plain","c":[{"t":"Str","c":"Two"},{"t":"Space"},{"t":"Str","c":"consecutive"},{"t":"Space"},{"t":"Str","c":"calls:"},{"t":"Space"},{"t":"Str","c":"fn1()"},{"t":"Space"},{"t":"Str","c":"fn1()."}]}],[{"t":"Plain","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"call"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"one"},{"t":"Space"},{"t":"Str","c":"arg:"},{"t":"Space"},{"t":"Str","c":"fn2(1)."}]}],[{"t":"Plain","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"call"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"two"},{"t":"Space"},{"t":"Str","c":"args:"},{"t":"Space"},{"t":"Str","c":"fn3(2,"},{"t":"Space"},{"t":"Str","c":"3)."}]}],[{"t":"Plain","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"call"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"args"},{"t":"Space"},{"t":"Str","c":"as"},{"t":"Space"},{"t":"Str","c":"kwargs:"},{"t":"Space"},{"t":"Str","c":"fn2(n:"},{"t":"Space"},{"t":"Str","c":"2)"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"fn3(b:"},{"t":"Space"},{"t":"Str","c":"4,"},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"5)."}]}]]},{"t":"Header","c":[1,["declarations",[],[]],[{"t":"Str","c":"Declarations"}]]},{"t":"Para","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"declaration:"}]},{"t":"CodeBlock","c":[["",[],[]],"-- fn1()\n1 + 2 + 3"]},{"t":"Para","c":[{"t":"Str","c":"All"},{"t":"Space"},{"t":"Str","c":"declarations"},{"t":"Space"},{"t":"Str","c":"should"},{"t":"Space"},{"t":"Str","c":"be"},{"t":"Space"},{"t":"Str","c":"print"},{"t":"Space"},{"t":"Str","c":"on"},{"t":"Space"},{"t":"Code","c":[["",[],[]],"--verbose"]},{"t":"Str","c":"."}]},{"t":"Para","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"declaration"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"one"},{"t":"Space"},{"t":"Str","c":"arg:"}]},{"t":"CodeBlock","c":[["",[],[]],"-- Also valid, Lua is the default: fn2(n)\n#n .. \" \" .. #n"]},{"t":"Para","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"declaration"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"two"},{"t":"Space"},{"t":"Str","c":"args:"}]},{"t":"CodeBlock","c":[["",[],[]],"; Changed lang and no space:fn3(a, b) -> fennel\n(* #a #b)"]},{"t":"Para","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"declaration"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"lang"},{"t":"Space"},{"t":"Str","c":"options:"}]},{"t":"CodeBlock","c":[["",[],[]],"# fn4(n) -> python -E -X utf8\n#n * #n"]},{"t":"Para","c":[{"t":"Str","c":"A"},{"t":"Space"},{"t":"Str","c":"declaration"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"arg"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"scaped:"}]},{"t":"CodeBlock","c":[["",[],[]],"-- fn5(x)\n#x .. \"\\#x\""]},{"t":"Header","c":[1,["calls-and-data-types",[],[]],[{"t":"Str","c":"Calls"},{"t":"Space"},{"t":"Str","c":"and"},{"t":"Space"},{"t":"Str","c":"Data"},{"t":"Space"},{"t":"Str","c":"Types"}]]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"Str","c":"fn2(3);"},{"t":"Space"},{"t":"Str","c":"integer"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2(1_000);"},{"t":"Space"},{"t":"Str","c":"integer"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"separator"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn4(1.0);"},{"t":"Space"},{"t":"Str","c":"float"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn5("},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"str"}]]},{"t":"Str","c":");"},{"t":"Space"},{"t":"Str","c":"string"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn5(true)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn5(false)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2([]);"},{"t":"Space"},{"t":"Str","c":"empty"},{"t":"Space"},{"t":"Str","c":"array"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"list"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"sequential"},{"t":"Space"},{"t":"Str","c":"table"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2([0,"},{"t":"Space"},{"t":"Str","c":"1]);"},{"t":"Space"},{"t":"Str","c":"array"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"list"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"sequential"},{"t":"Space"},{"t":"Str","c":"table"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2({});"},{"t":"Space"},{"t":"Str","c":"empty"},{"t":"Space"},{"t":"Str","c":"dict"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"table"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2({"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"k1"}]]},{"t":"Str","c":":"},{"t":"Space"},{"t":"Str","c":"1,"},{"t":"Space"},{"t":"Quoted","c":[{"t":"DoubleQuote"},[{"t":"Str","c":"k2"}]]},{"t":"Str","c":":"},{"t":"Space"},{"t":"Str","c":"2});"},{"t":"Space"},{"t":"Str","c":"dict"},{"t":"Space"},{"t":"Str","c":"/"},{"t":"Space"},{"t":"Str","c":"table"}]}]]},{"t":"Header","c":[1,["messy-calls",[],[]],[{"t":"Str","c":"Messy"},{"t":"Space"},{"t":"Str","c":"Calls"}]]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"Str","c":"fn1("},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2("},{"t":"Space"},{"t":"Str","c":"4)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2(5"},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2("},{"t":"Space"},{"t":"Str","c":"6"},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2("},{"t":"Space"},{"t":"Str","c":"n:"},{"t":"Space"},{"t":"Str","c":"7)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2(n:"},{"t":"Space"},{"t":"Str","c":"8"},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2("},{"t":"Space"},{"t":"Str","c":"n:"},{"t":"Space"},{"t":"Str","c":"9"},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn2(n:10)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3("},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"6,"},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"7)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3("},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"8"},{"t":"Space"},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"9)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3("},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"10"},{"t":"Space"},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"11)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3("},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"12"},{"t":"Space"},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"13)"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3("},{"t":"Space"},{"t":"Str","c":"a:"},{"t":"Space"},{"t":"Str","c":"14"},{"t":"Space"},{"t":"Str","c":","},{"t":"Space"},{"t":"Str","c":"b:"},{"t":"Space"},{"t":"Str","c":"15"},{"t":"Space"},{"t":"Str","c":")"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3(a:16,b:17)"}]}]]}]} diff --git a/tests/pass.lit.warns.md b/tests/pass.lit.warns.md index 7fd9b82..2a3c0f0 100644 --- a/tests/pass.lit.warns.md +++ b/tests/pass.lit.warns.md @@ -18,5 +18,5 @@ # Calls -* fn1() -* fn3(1) +- fn1() +- fn3(1) diff --git a/tests/pass.lit.warns.md.json b/tests/pass.lit.warns.md.json new file mode 100644 index 0000000..b2db93f --- /dev/null +++ b/tests/pass.lit.warns.md.json @@ -0,0 +1 @@ +{"pandoc-api-version":[1,23],"meta":{},"blocks":[{"t":"Header","c":[1,["declaration-override",[],[]],[{"t":"Str","c":"Declaration"},{"t":"Space"},{"t":"Str","c":"Override"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- fn1()\n1 + 2 + 3\n\n-- fn1()\n4 + 5 + 6"]},{"t":"Header","c":[1,["unused-declaration",[],[]],[{"t":"Str","c":"Unused"},{"t":"Space"},{"t":"Str","c":"Declaration"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- fn2(n)\n#n .. \" \" .. #n"]},{"t":"Header","c":[1,["declaration-with-unused-argument",[],[]],[{"t":"Str","c":"Declaration"},{"t":"Space"},{"t":"Str","c":"with"},{"t":"Space"},{"t":"Str","c":"Unused"},{"t":"Space"},{"t":"Str","c":"Argument"}]]},{"t":"CodeBlock","c":[["",[],[]],"-- fn3(a)\n7 + 8 + 9"]},{"t":"Header","c":[1,["calls",[],[]],[{"t":"Str","c":"Calls"}]]},{"t":"BulletList","c":[[{"t":"Plain","c":[{"t":"Str","c":"fn1()"}]}],[{"t":"Plain","c":[{"t":"Str","c":"fn3(1)"}]}]]}]}