Wikipedia:Lua/Modul/JSONutil/Test
Vorlagenprogrammierung | Diskussionen | Lua | Test | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
Test cases of Lua functions; version: 2020-11-08
fiat
WerkelnInput | Code (fault) | String (trailing) |
---|---|---|
{ "simple": "assignment" } | – | { "simple": "assignment" } |
{ "beg": "\"escaped quote", "mid": "escaped\"quote", "end": "escaped quote\"" } | – | { "beg": "\"escaped quote", "mid": "escaped\"quote", "end": "escaped quote\"" } |
{ "multiline": "Some textLFin several linesLFalso withTabtabulator" } | – | { "multiline": "Some text\nin several lines\nalso with\ttabulator" } |
{ "lineseps": "UxLFstyle andCRApple and MSCRLFDOS" } | – | { "lineseps": "Ux\nstyle and\nApple and MS\nDOS" } |
{ "commented": true } // line at end | – | { "commented": true } |
{ "commented":// line amidLF true// second lineLF } | – | { "commented": true } |
{ "commented": /* middle */true } | – | { "commented": true } |
{ "commented":/* middle */"edge" } | – | { "commented":"edge" } |
{ "NoComment": "An URL http://example.org/ is not a comment" } | – | { "NoComment": "An URL http://example.org/ is not a comment" } |
No JSON | Bracket0 | No JSON |
{ "simple": "assignment" } garbage | Trailing | garbage |
{ "quoting": 'apostrophes' } | Qoute | 'apostrophes' } |
{ "missing": "qoute } | QouteEnd | qoute } |
{ "missing": "qoute (escaped)\" } | QouteEnd | qoute (escaped)\" } |
{ "htab": "h�tab" } | ControlChar | tab" } |
{ "comma": "trailing", } | CommaEnd | , } |
{ "comma": [ "trailing", ] } | CommaEnd | , ] } |
{ "comma": true, } | CommaEnd | : true, } |
{ "unclosed": true | BracketCloseLack | } |
{ "unclosed": "terminating" | BracketCloseLack | } |
{ { "unclosed": 99 | BracketCloseLack | 2 } |
{ "unclosed": [ 42 } | BracketCloseLack | ] |
{ "unclosed": [ 42 ] ] } | BracketClosePlus | ] |
{ "unclosed": [ 42 ] ] ] } | BracketClosePlus | 2 ] |
{ "commented": /* middle true } | CommentEnd | middle true } |
fault
Werkeln- Bracket0
- First visible character must be { – Trailing1
- BracketCloseLack
- Closing bracket missing for: – Trailing2
- BracketClosePlus
- Too many closing brackets: – Trailing3
- CommaEnd
- Trailing comma after last list item – Trailing4
- CommentEnd
- Comment starting with /* not terminated by */ – Trailing5
- ControlChar
- Control character detected other than LF Tab CR (ASCII < 32) – Trailing6
- Qoute
- Found apostrophe instead of quotation mark – Trailing7
- QouteEnd
- Terminating quotation mark not found – Trailing8
- Trailing
- Trailing text behind JSON end detected – Trailing9
fetch
WerkelnSame cases as with #fiat.
{
"simple": "assignment"
}
{
"beg": "\"escaped quote",
"mid": "escaped\"quote",
"end": "escaped quote\""
}
{
"multiline": "Some text\nin several lines\nalso with\ttabulator"
}
{
"lineseps": "Ux\nstyle and\nApple and MS\nDOS"
}
{
"commented": true
}
{
"commented": true
}
{
"commented": true
}
{
"commented": "edge"
}
{
"NoComment": "An URL http://example.org/ is not a comment"
}
<span class="error">First visible character must be { – No JSON</span>
<span class="error">Trailing text behind JSON end detected – garbage</span>
<span class="error">Found apostrophe instead of quotation mark – 'apostrophes' }</span>
<span class="error">Terminating quotation mark not found – qoute }</span>
<span class="error">Terminating quotation mark not found – qoute (escaped)\" }</span>
<span class="error">Control character detected other than LF Tab CR (ASCII < 32) – tab" }</span>
<span class="error">Trailing comma after last list item – , }</span>
<span class="error">Trailing comma after last list item – , ] }</span>
<span class="error">Trailing comma after last list item – : true, }</span>
<span class="error">Closing bracket missing for: – }</span>
<span class="error">Closing bracket missing for: – }</span>
<span class="error">Closing bracket missing for: – 2 }</span>
<span class="error">Closing bracket missing for: – ]</span>
<span class="error">Too many closing brackets: – ]</span>
<span class="error">Too many closing brackets: – 2 ]</span>
<span class="error">Comment starting with /* not terminated by */ – middle true }</span>