FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SRL-JavaScript/test/parseParentheses-test.js at update-submodule · AuxControl/SRL-JavaScript · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
AuxControl
/
SRL-JavaScript
Public
forked from
SimpleRegex/SRL-JavaScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SRL-JavaScript
/
test
/
parseParentheses-test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
81 lines (62 loc) · 2.59 KB
Breadcrumbs
SRL-JavaScript
/
test
/
parseParentheses-test.js
Copy path
File metadata and controls
81 lines (62 loc) · 2.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
'use strict'
const
assert
=
require
(
'assert'
)
const
Literally
=
require
(
'../lib/Language/Helpers/Literally'
)
const
parseParentheses
=
require
(
'../lib/Language/Helpers/parseParentheses'
)
describe
(
'ParseParentheses Test'
,
(
)
=>
{
it
(
'Default'
,
(
)
=>
{
assert
.
deepEqual
(
parseParentheses
(
'foo (bar) baz'
)
,
[
'foo'
,
[
'bar'
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'(foo (bar) baz)'
)
,
[
'foo'
,
[
'bar'
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo (bar)'
)
,
[
'foo'
,
[
'bar'
]
]
)
assert
.
deepEqual
(
parseParentheses
(
'(foo)bar'
)
,
[
[
'foo'
]
,
'bar'
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo (0)'
)
,
[
'foo'
,
[
'0'
]
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo (bar (nested)) baz'
)
,
[
'foo'
,
[
'bar'
,
[
'nested'
]
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo boo (bar (nested) something) baz (bar (foo foo))'
)
,
[
'foo boo'
,
[
'bar'
,
[
'nested'
]
,
'something'
]
,
'baz'
,
[
'bar'
,
[
'foo foo'
]
]
]
)
}
)
it
(
'Escaping'
,
(
)
=>
{
assert
.
deepEqual
(
parseParentheses
(
'foo (bar "(bla)") baz'
)
,
[
'foo'
,
[
'bar'
,
new
Literally
(
'(bla)'
)
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'sample "foo" bar'
)
,
[
'sample'
,
new
Literally
(
'foo'
)
,
'bar'
]
)
assert
.
deepEqual
(
parseParentheses
(
'sample "foo"'
)
,
[
'sample'
,
new
Literally
(
'foo'
)
]
)
assert
.
deepEqual
(
parseParentheses
(
'bar "(b\\"la)" baz'
)
,
[
'bar'
,
new
Literally
(
'(b\\"la)'
)
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo "ba\'r" baz'
)
,
[
'foo'
,
new
Literally
(
'ba\'r'
)
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo (bar \'(b\\\'la)\') baz'
)
,
[
'foo'
,
[
'bar'
,
new
Literally
(
'(b\\\'la)'
)
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'bar "b\\\\\" (la) baz'
)
,
[
'bar'
,
new
Literally
(
'b\\\\'
)
,
[
'la'
]
,
'baz'
]
)
assert
.
deepEqual
(
parseParentheses
(
'"fizz" and "buzz" (with) "bar"'
)
,
[
new
Literally
(
'fizz'
)
,
'and'
,
new
Literally
(
'buzz'
)
,
[
'with'
]
,
new
Literally
(
'bar'
)
]
)
assert
.
deepEqual
(
parseParentheses
(
'foo \\"boo (bar (nes"ted) s\\"om\\"")ething) baz (bar (foo foo))'
)
,
[
'foo \\"boo'
,
[
'bar'
,
[
'nes'
,
new
Literally
(
'ted) s"om"'
)
]
,
'ething'
]
,
'baz'
,
[
'bar'
,
[
'foo foo'
]
]
]
)
}
)
it
(
'Empty'
,
(
)
=>
{
assert
.
deepEqual
(
parseParentheses
(
''
)
,
[
]
)
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL