@@ -6,51 +6,51 @@ var visit = require('unist-util-visit')
6
6
var retext = require ( 'retext' )
7
7
var isLiteral = require ( '.' )
8
8
9
- test ( 'isLiteral()' , function ( t ) {
9
+ test ( 'isLiteral()' , function ( t ) {
10
10
t . throws (
11
- function ( ) {
11
+ function ( ) {
12
12
isLiteral ( )
13
13
} ,
14
14
/ P a r e n t m u s t b e a n o d e / ,
15
15
'should throw without arguments'
16
16
)
17
17
18
18
t . throws (
19
- function ( ) {
19
+ function ( ) {
20
20
isLiteral ( { } )
21
21
} ,
22
22
/ P a r e n t m u s t b e a n o d e / ,
23
23
'should throw without parent'
24
24
)
25
25
26
26
t . throws (
27
- function ( ) {
27
+ function ( ) {
28
28
isLiteral ( { children : [ ] } )
29
29
} ,
30
30
/ I n d e x m u s t b e a n u m b e r / ,
31
31
'should throw without node'
32
32
)
33
33
34
34
t . throws (
35
- function ( ) {
35
+ function ( ) {
36
36
isLiteral ( { children : [ ] } , { type : 'a' } )
37
37
} ,
38
38
/ N o d e m u s t b e a c h i l d o f ` p a r e n t ` / ,
39
39
'should throw if `node` is not in `parent`'
40
40
)
41
41
42
- t . doesNotThrow ( function ( ) {
42
+ t . doesNotThrow ( function ( ) {
43
43
var n = { type : 'a' }
44
44
isLiteral ( { children : [ n ] } , n )
45
45
} , 'should not throw if `node` is in `parent`' )
46
46
47
- t . doesNotThrow ( function ( ) {
48
- process ( 'Well? Ha! Funky' , function ( node , index , parent ) {
47
+ t . doesNotThrow ( function ( ) {
48
+ process ( 'Well? Ha! Funky' , function ( node , index , parent ) {
49
49
assert . strictEqual ( isLiteral ( parent , index ) , false )
50
50
} )
51
51
} , 'should work on single word sentences' )
52
52
53
- t . doesNotThrow ( function ( ) {
53
+ t . doesNotThrow ( function ( ) {
54
54
; [
55
55
'Foo - is meant as a literal.' ,
56
56
'Foo – is meant as a literal.' ,
@@ -61,14 +61,14 @@ test('isLiteral()', function(t) {
61
61
'Foo—is meant as a literal.' ,
62
62
'Foo: is meant as a literal.' ,
63
63
'Foo; is meant as a literal.'
64
- ] . forEach ( function ( fixture ) {
65
- process ( fixture , function ( node , index , parent ) {
64
+ ] . forEach ( function ( fixture ) {
65
+ process ( fixture , function ( node , index , parent ) {
66
66
assert . strictEqual ( isLiteral ( parent , index ) , index === 0 , fixture )
67
67
} )
68
68
} )
69
69
} , 'Initial' )
70
70
71
- t . doesNotThrow ( function ( ) {
71
+ t . doesNotThrow ( function ( ) {
72
72
; [
73
73
'Meant as a literal is - foo.' ,
74
74
'Meant as a literal is – foo.' ,
@@ -79,8 +79,8 @@ test('isLiteral()', function(t) {
79
79
'Meant as a literal is—foo.' ,
80
80
'Meant as a literal is: foo.' ,
81
81
'Meant as a literal is; foo.'
82
- ] . forEach ( function ( fixture ) {
83
- process ( fixture , function ( node , index , parent ) {
82
+ ] . forEach ( function ( fixture ) {
83
+ process ( fixture , function ( node , index , parent ) {
84
84
assert . strictEqual (
85
85
isLiteral ( parent , index ) ,
86
86
index === parent . children . length - 2 ,
@@ -90,7 +90,7 @@ test('isLiteral()', function(t) {
90
90
} )
91
91
} , 'Final' )
92
92
93
- t . doesNotThrow ( function ( ) {
93
+ t . doesNotThrow ( function ( ) {
94
94
; [
95
95
'The word, foo, is meant as a literal.' ,
96
96
'The word -foo- is meant as a literal.' ,
@@ -118,8 +118,8 @@ test('isLiteral()', function(t) {
118
118
'The word {foo} is meant as a literal.' ,
119
119
'The word ⟨foo⟩ is meant as a literal.' ,
120
120
'The word 「foo」 is meant as a literal.'
121
- ] . forEach ( function ( fixture , n ) {
122
- process ( fixture , function ( node , index , parent ) {
121
+ ] . forEach ( function ( fixture , n ) {
122
+ process ( fixture , function ( node , index , parent ) {
123
123
var pos = 5
124
124
125
125
// Adjacent hyphens are part of the word.
0 commit comments