@@ -13,7 +13,7 @@ export default {
13
13
ignoreTagless : false ,
14
14
} ,
15
15
] ,
16
- output : '`\nSELECT\n 1\n`' ,
16
+ output : '`\n SELECT\n 1\n`' ,
17
17
} ,
18
18
{
19
19
code : '`SELECT 2`' ,
@@ -31,7 +31,7 @@ export default {
31
31
spaces : 2 ,
32
32
} ,
33
33
] ,
34
- output : '`\nSELECT\n 2\n`' ,
34
+ output : '`\n SELECT\n 2\n`' ,
35
35
} ,
36
36
{
37
37
code : 'sql.unsafe`SELECT 3`' ,
@@ -45,7 +45,7 @@ export default {
45
45
ignoreInline : false ,
46
46
} ,
47
47
] ,
48
- output : 'sql.unsafe`\nSELECT\n 3\n`' ,
48
+ output : 'sql.unsafe`\n SELECT\n 3\n`' ,
49
49
} ,
50
50
{
51
51
code : 'sql.type()`SELECT 3`' ,
@@ -59,7 +59,7 @@ export default {
59
59
ignoreInline : false ,
60
60
} ,
61
61
] ,
62
- output : 'sql.type()`\nSELECT\n 3\n`' ,
62
+ output : 'sql.type()`\n SELECT\n 3\n`' ,
63
63
} ,
64
64
{
65
65
code : "`SELECT ${'foo'} FROM ${'bar'}`" ,
@@ -74,10 +74,116 @@ export default {
74
74
ignoreTagless : false ,
75
75
} ,
76
76
] ,
77
- output : "`\nSELECT\n ${'foo'}\nFROM\n ${'bar'}\n`" ,
77
+ output : "`\n SELECT\n ${'foo'}\n FROM\n ${'bar'}\n`" ,
78
+ } ,
79
+ {
80
+ code : "\t\t`SELECT ${'foo'} FROM ${'bar'}`" ,
81
+ errors : [
82
+ {
83
+ message : 'Format the query' ,
84
+ } ,
85
+ ] ,
86
+ options : [
87
+ {
88
+ ignoreInline : false ,
89
+ ignoreTagless : false ,
90
+ } ,
91
+ ] ,
92
+ output :
93
+ "\t\t`\n\t\t SELECT\n\t\t ${'foo'}\n\t\t FROM\n\t\t ${'bar'}\n\t\t`" ,
94
+ } ,
95
+ {
96
+ code : '\tconst s = sql`SELECT\n1\nFROM\ntable`' ,
97
+ errors : [
98
+ {
99
+ message : 'Format the query' ,
100
+ } ,
101
+ ] ,
102
+ options : [
103
+ { } ,
104
+ {
105
+ spaces : 2 ,
106
+ } ,
107
+ ] ,
108
+ output :
109
+ '\tconst s = sql`\n\t SELECT\n\t 1\n\t FROM\n\t table\n\t`' ,
110
+ } ,
111
+ {
112
+ code : '\tconst s = sql`SELECT 1 FROM table`' ,
113
+ errors : [
114
+ {
115
+ message : 'Format the query' ,
116
+ } ,
117
+ ] ,
118
+ options : [
119
+ {
120
+ ignoreInline : false ,
121
+ } ,
122
+ {
123
+ tabs : true ,
124
+ } ,
125
+ ] ,
126
+ output :
127
+ '\tconst s = sql`\n\t\tSELECT\n\t\t\t1\n\t\tFROM\n\t\t\ttable\n\t`' ,
128
+ } ,
129
+ {
130
+ code : '\tconst s = sql`SELECT 1 FROM table`' ,
131
+ errors : [
132
+ {
133
+ message : 'Format the query' ,
134
+ } ,
135
+ ] ,
136
+ options : [
137
+ {
138
+ ignoreInline : false ,
139
+ } ,
140
+ {
141
+ spaces : 0 ,
142
+ tabs : false ,
143
+ } ,
144
+ ] ,
145
+ output :
146
+ '\tconst s = sql`\n\t\tSELECT\n\t\t\t1\n\t\tFROM\n\t\t\ttable\n\t`' ,
147
+ } ,
148
+ {
149
+ code : ' const s = sql`SELECT 1 FROM table`' ,
150
+ errors : [
151
+ {
152
+ message : 'Format the query' ,
153
+ } ,
154
+ ] ,
155
+ options : [
156
+ {
157
+ ignoreInline : false ,
158
+ } ,
159
+ {
160
+ spaces : 0 ,
161
+ tabs : false ,
162
+ } ,
163
+ ] ,
164
+ output :
165
+ ' const s = sql`\n SELECT\n 1\n FROM\n table\n `' ,
166
+ } ,
167
+ {
168
+ code : '\tsql`SELECT 1 FROM table`' ,
169
+ errors : [
170
+ {
171
+ message : 'Format the query' ,
172
+ } ,
173
+ ] ,
174
+ options : [
175
+ {
176
+ ignoreInline : false ,
177
+ matchIndentation : false ,
178
+ } ,
179
+ ] ,
180
+ output : '\tsql`\nSELECT\n 1\nFROM\n table\n`' ,
78
181
} ,
79
182
] ,
80
183
valid : [
184
+ {
185
+ code : 'sql`SELECT 1`' ,
186
+ } ,
81
187
{
82
188
code : 'sql`SELECT 1`' ,
83
189
options : [
@@ -104,5 +210,14 @@ export default {
104
210
} ,
105
211
] ,
106
212
} ,
213
+ {
214
+ code : '\tconst s = sql`\n\t SELECT\n\t 1\n\t FROM\n\t table\n\t`' ,
215
+ options : [
216
+ { } ,
217
+ {
218
+ spaces : 2 ,
219
+ } ,
220
+ ] ,
221
+ } ,
107
222
] ,
108
223
} ;
0 commit comments