-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.js
More file actions
executable file
·118 lines (117 loc) · 2.22 KB
/
Copy pathtest.js
File metadata and controls
executable file
·118 lines (117 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env node
/* eslint-disable quotes */
"use strict"
const litest = require("litests")
const luon = require("./index.js")
new litest.BulkTester(luon).testEqualsAll([
"read",
{
true: true,
false: false,
nil: undefined,
12345: 12345,
1: 1,
"-1": -1,
"0xFF": 255,
"0xFFP1": 255 * 2,
"1e10": 1e10,
0.1: 0.1,
"'string'": "string",
'"string"': "string",
"[[string]]": "string",
"[=[string]=]": "string",
"'\\226\\130\\172'": "€",
"'\\xF0\\x90\\x8D\\x88'": "𐍈", // two character utf 16
"{a=1, b=2}": {
a: 1,
b: 2
},
"{a=1}": {
a: 1
},
"{[ [[yay]]]=true}": {
yay: true
},
"{ much = 'spacing' }": {
much: "spacing"
},
"{ 1 , 2 }": [1, 2],
"[[_[_]\n_[_]\n_[_]\n_[]\n]]": "_[_]\n_[_]\n_[_]\n_[]\n"
},
"readRemoveComments",
{
"10--comment": 10,
"10--[[comment]]0": 100
},
"removeCommentsText",
{
"some--comment": "some",
"some--[[multi-line comment]]": "some",
"some--[===[multi-line comment]===]": "some",
"some--comment\nnext line": "some\nnext line",
"some--[=[comment\n]=]next line": "some\nnext line"
},
"removeSpacingText",
{
"some tests": "sometests",
"'some tests'": "'some tests'",
"[===[some tests]===]": "[===[some tests]===]"
},
"writeText",
[
NaN,
"nil",
+Infinity,
"nil",
-Infinity,
"nil",
[true, false, true, undefined],
"{true,false,true,nil}",
{a:1,b:2},
"{a=1,b=2}",
{'':1,'x-y':2,'x_y':3,'λ':5},
"{[\"\"]=1,[\"x-y\"]=2,x_y=3,[\"λ\"]=5}",
"test",
'"test"',
"test\nheh",
'"test\\nheh"',
"\x20",
'"\x20"',
"a",
'"a"',
"\u0007",
'"\\a"',
"€",
'"€"',
123456,
"1.23456e5",
101,
"1.01e2",
10,
"1e1"
],
"writeCompressedText",
["test'test", '"test\'test"', 1000000, "1e6", 0.1, ".1", 255.99609375, "0xff.ff", -1, "-1"],
"writeBeautifiedText",
[
[true, false, true, undefined],
"{\n true,\n false,\n true,\n nil\n}",
[
[1, 2],
[3, 4]
],
"{\n {\n 1,\n 2\n },\n {\n 3,\n 4\n }\n}",
0,
"0",
0.001,
"1e-3",
0.69,
"0.69",
"\n".repeat(10) + "]==]",
"[=[\n" + "\n".repeat(10) + "]==]]=]",
"\n".repeat(10) + "]==",
"[[\n" + "\n".repeat(10) + "]==]]",
"\n".repeat(10) + "]]=]==]",
"[===[\n" + "\n".repeat(10) + "]]=]==]]===]"
]
])