@malloydata/malloy 0.0.80-dev230830211713 → 0.0.80-dev230903192621

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import './parse-expects';
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ /* eslint-disable no-console */
3
+ /*
4
+ * Copyright 2023 Google LLC
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining
7
+ * a copy of this software and associated documentation files
8
+ * (the "Software"), to deal in the Software without restriction,
9
+ * including without limitation the rights to use, copy, modify, merge,
10
+ * publish, distribute, sublicense, and/or sell copies of the Software,
11
+ * and to permit persons to whom the Software is furnished to do so,
12
+ * subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be
15
+ * included in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const test_translator_1 = require("./test-translator");
27
+ require("./parse-expects");
28
+ describe('source:', () => {
29
+ test('table', () => {
30
+ expect("source: testA is table('aTable')").toTranslate();
31
+ });
32
+ test('shorcut fitlered table', () => {
33
+ expect("source: xA is table('aTable') {? astr ~ 'a%' }").toTranslate();
34
+ });
35
+ test('shorcut fitlered table m4warning', () => {
36
+ expect(`
37
+ ##! m4warnings
38
+ source: xA is conn.table('aTable') extend {? astr ~ 'a%' }
39
+ `).toTranslateWithWarnings('Filter shortcut `{? condition }` is deprecated; use `{ where: condition } instead');
40
+ });
41
+ test('fitlered table', () => {
42
+ expect("source: testA is table('aTable') { where: astr ~ 'a%' }").toTranslate();
43
+ });
44
+ test('ref source with no refinement', () => {
45
+ expect('source: testA is a').toTranslate();
46
+ });
47
+ test('from(query)', () => {
48
+ expect('source: testA is from(a->{group_by: astr})').toTranslate();
49
+ });
50
+ test('refine source', () => {
51
+ expect('source: aa is a { dimension: a is astr }').toTranslate();
52
+ });
53
+ test('source refinement preserves original', () => {
54
+ const x = new test_translator_1.TestTranslator('source: na is a + { dimension: one is 1 }');
55
+ expect(x).toTranslate();
56
+ const a = x.getSourceDef('a');
57
+ if (a) {
58
+ const aFields = a.fields.map(f => f.as || f.name);
59
+ expect(aFields).toContain('astr');
60
+ expect(aFields).not.toContain('one');
61
+ }
62
+ });
63
+ describe('source properties', () => {
64
+ test('single dimension', () => {
65
+ expect('source: aa is a { dimension: x is 1 }').toTranslate();
66
+ });
67
+ test('multiple dimensions', () => {
68
+ expect(`
69
+ source: aa is a {
70
+ dimension:
71
+ x is 1
72
+ y is 2
73
+ }
74
+ `).toTranslate();
75
+ });
76
+ test('single declare', () => {
77
+ expect('source: aa is a { declare: x is 1 }').toTranslate();
78
+ });
79
+ test('multiple declare', () => {
80
+ expect(`
81
+ source: aa is a {
82
+ declare:
83
+ x is 1
84
+ y is 2
85
+ }
86
+ `).toTranslate();
87
+ });
88
+ test('single measure', () => {
89
+ expect('source: aa is a { measure: x is count() }').toTranslate();
90
+ });
91
+ test('multiple measures', () => {
92
+ expect(`
93
+ source: aa is a {
94
+ measure:
95
+ x is count()
96
+ y is x * x
97
+ }
98
+ `).toTranslate();
99
+ });
100
+ test('single where', () => {
101
+ expect('source: aa is a { where: ai > 10 }').toTranslate();
102
+ });
103
+ test('multiple where', () => {
104
+ expect(`
105
+ source: aa is a {
106
+ where:
107
+ ai > 10,
108
+ af < 1000
109
+ }
110
+ `).toTranslate();
111
+ });
112
+ test('where clause can use the join namespace in source refined query', () => {
113
+ expect(`
114
+ source: flights is table('malloytest.flights') + {
115
+ query: boo is {
116
+ join_one: carriers is table('malloytest.carriers') on carrier = carriers.code
117
+ where: carriers.code = 'WN' | 'AA'
118
+ group_by: carriers.nickname
119
+ aggregate: flight_count is count()
120
+ }
121
+ }`).toTranslate();
122
+ });
123
+ describe('joins', () => {
124
+ test('with', () => {
125
+ expect('source: x is a { join_one: b with astr }').toTranslate();
126
+ });
127
+ test('with', () => {
128
+ expect((0, test_translator_1.model) `source: x is a { join_one: y is b with astr }`).toTranslate();
129
+ });
130
+ test('with dotted ref', () => {
131
+ expect((0, test_translator_1.model) `source: x is ab { join_one: xz is a with b.astr }`).toTranslate();
132
+ });
133
+ test('one on', () => {
134
+ expect((0, test_translator_1.model) `source: x is a { join_one: b on astr = b.astr }`).toTranslate();
135
+ });
136
+ test('one is on', () => {
137
+ expect('source: x is a { join_one: y is b on astr = y.astr }').toTranslate();
138
+ });
139
+ test('many on', () => {
140
+ expect('source: nab is a { join_many: b on astr = b.astr }').toTranslate();
141
+ });
142
+ test('many is on', () => {
143
+ expect('source: y is a { join_many: x is b on astr = x.astr }').toTranslate();
144
+ });
145
+ test('cross', () => {
146
+ expect('source: nab is a { join_cross: b }').toTranslate();
147
+ });
148
+ test('cross is', () => {
149
+ expect('source: nab is a { join_cross: xb is b }').toTranslate();
150
+ });
151
+ test('cross on', () => {
152
+ expect('source: nab is a { join_cross: b on true}').toTranslate();
153
+ });
154
+ test('multiple joins', () => {
155
+ expect(`
156
+ source: nab is a {
157
+ join_one:
158
+ b with astr,
159
+ br is b with astr
160
+ }
161
+ `).toTranslate();
162
+ });
163
+ test('with requires primary key', () => {
164
+ expect((0, test_translator_1.markSource) `
165
+ source: nb is b {
166
+ join_one: ${"bb is table('aTable') with astr"}
167
+ }
168
+ `).translationToFailWith('join_one: Cannot use with unless source has a primary key');
169
+ });
170
+ });
171
+ test('primary_key', () => {
172
+ expect('source: c is a { primary_key: ai }').toTranslate();
173
+ });
174
+ test('rename', () => {
175
+ expect('source: c is a { rename: nn is ai }').toTranslate();
176
+ });
177
+ test('accept single', () => {
178
+ const onlyAstr = new test_translator_1.TestTranslator('source: c is a { accept: astr }');
179
+ expect(onlyAstr).toTranslate();
180
+ const c = onlyAstr.getSourceDef('c');
181
+ if (c) {
182
+ expect(c.fields.length).toBe(1);
183
+ }
184
+ });
185
+ test('accept multi', () => {
186
+ expect('source: c is a { accept: astr, af }').toTranslate();
187
+ });
188
+ test('except single', () => {
189
+ const noAstr = new test_translator_1.TestTranslator('source: c is a { except: astr }');
190
+ expect(noAstr).toTranslate();
191
+ const c = noAstr.getSourceDef('c');
192
+ if (c) {
193
+ const foundAstr = c.fields.find(f => f.name === 'astr');
194
+ expect(foundAstr).toBeUndefined();
195
+ }
196
+ });
197
+ test('except multi', () => {
198
+ expect('source: c is a { except: astr, af }').toTranslate();
199
+ });
200
+ test('explore-query', () => {
201
+ expect('source: c is a {query: q is { group_by: astr } }').toTranslate();
202
+ });
203
+ test('refined explore-query', () => {
204
+ expect(`
205
+ source: abNew is ab {
206
+ query: for1 is aturtle {? ai = 1 }
207
+ }
208
+ `).toTranslate();
209
+ });
210
+ test('refined explore-query m4warning', () => {
211
+ expect(`
212
+ ##! m4warnings
213
+ source: abNew is ab extend {
214
+ query: for1 is aturtle refine {? ai = 1 }
215
+ }
216
+ `).toTranslateWithWarnings('Filter shortcut `{? condition }` is deprecated; use `{ where: condition } instead');
217
+ });
218
+ test('chained explore-query', () => {
219
+ expect(`
220
+ source: c is a {
221
+ query: chain is {
222
+ group_by: astr
223
+ } -> {
224
+ top: 10; order_by: astr
225
+ project: *
226
+ }
227
+ }
228
+ `).toTranslate();
229
+ });
230
+ test('multiple explore-query', () => {
231
+ expect(`
232
+ source: abNew is ab {
233
+ query:
234
+ q1 is { group_by: astr },
235
+ q2 is { group_by: ai }
236
+ }
237
+ `).toTranslate();
238
+ });
239
+ });
240
+ });
241
+ //# sourceMappingURL=source.spec.js.map
@@ -1,4 +1,4 @@
1
- import { DocumentLocation, FieldDef, ModelDef, NamedModelObject, PipeSegment, Query, StructDef, TurtleDef } from '../../model/malloy_types';
1
+ import { DocumentLocation, FieldDef, ModelDef, NamedModelObject, PipeSegment, Query, SQLBlockSource, SQLBlockStructDef, StructDef, TurtleDef } from '../../model/malloy_types';
2
2
  import { MalloyElement } from '../ast';
3
3
  import { NameSpace } from '../ast/types/name-space';
4
4
  import { ModelEntry } from '../ast/types/model-entry';
@@ -63,4 +63,5 @@ interface HasTranslator extends MarkedSource {
63
63
  export declare function expr(unmarked: TemplateStringsArray, ...marked: string[]): HasTranslator;
64
64
  export declare function model(unmarked: TemplateStringsArray, ...marked: string[]): HasTranslator;
65
65
  export declare function markSource(unmarked: TemplateStringsArray, ...marked: string[]): MarkedSource;
66
+ export declare function getSelectOneStruct(sqlBlock: SQLBlockSource): SQLBlockStructDef;
66
67
  export {};
@@ -23,7 +23,7 @@
23
23
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
  */
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.markSource = exports.model = exports.expr = exports.getJoinField = exports.getQueryField = exports.getFieldDef = exports.getModelQuery = exports.getExplore = exports.BetaExpression = exports.TestTranslator = exports.TestChildTranslator = exports.aTableDef = exports.pretty = void 0;
26
+ exports.getSelectOneStruct = exports.markSource = exports.model = exports.expr = exports.getJoinField = exports.getQueryField = exports.getFieldDef = exports.getModelQuery = exports.getExplore = exports.BetaExpression = exports.TestTranslator = exports.TestChildTranslator = exports.aTableDef = exports.pretty = void 0;
27
27
  const util_1 = require("util");
28
28
  const malloy_types_1 = require("../../model/malloy_types");
29
29
  const ast_1 = require("../ast");
@@ -478,4 +478,27 @@ function markSource(unmarked, ...marked) {
478
478
  return { code, locations };
479
479
  }
480
480
  exports.markSource = markSource;
481
+ function getSelectOneStruct(sqlBlock) {
482
+ const selectThis = sqlBlock.select[0];
483
+ if (!(0, malloy_types_1.isSQLFragment)(selectThis)) {
484
+ throw new Error('weird test support error sorry');
485
+ }
486
+ return {
487
+ type: 'struct',
488
+ name: sqlBlock.name,
489
+ dialect: 'standardsql',
490
+ structSource: {
491
+ type: 'sql',
492
+ method: 'subquery',
493
+ sqlBlock: {
494
+ type: 'sqlBlock',
495
+ name: sqlBlock.name,
496
+ selectStr: selectThis.sql,
497
+ },
498
+ },
499
+ structRelationship: { type: 'basetable', connectionName: 'bigquery' },
500
+ fields: [{ type: 'number', name: 'one' }],
501
+ };
502
+ }
503
+ exports.getSelectOneStruct = getSelectOneStruct;
481
504
  //# sourceMappingURL=test-translator.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.80-dev230830211713",
3
+ "version": "0.0.80-dev230903192621",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,112 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- require("./parse-expects");
26
- const test_translator_1 = require("./test-translator");
27
- describe('refinement location rules', () => {
28
- test('where clauses go into the first segment', () => {
29
- const doc = (0, test_translator_1.model) `
30
- query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
31
- query: checkme is refineme refine { where: astr = 'a' }`;
32
- expect(doc).toTranslate();
33
- const checkme = doc.translator.getQuery('checkme');
34
- expect(checkme).toBeDefined();
35
- if (checkme) {
36
- const whereClause = checkme.pipeline[0].filterList;
37
- expect(whereClause).toBeDefined();
38
- if (whereClause) {
39
- expect(whereClause.length).toBe(1);
40
- }
41
- }
42
- });
43
- test('having clauses go into the last segment', () => {
44
- const doc = (0, test_translator_1.model) `
45
- query: refineme is a -> { group_by: ai,astr } -> { group_by: ai, aggregate: ac is count() }
46
- query: checkme is refineme refine { having: ac > 0 }`;
47
- expect(doc).toTranslate();
48
- const checkme = doc.translator.getQuery('checkme');
49
- expect(checkme).toBeDefined();
50
- if (checkme) {
51
- const havingClause = checkme.pipeline[1].filterList;
52
- expect(havingClause).toBeDefined();
53
- if (havingClause) {
54
- expect(havingClause.length).toBe(1);
55
- }
56
- }
57
- });
58
- test('limit goes into the last segment', () => {
59
- const doc = (0, test_translator_1.model) `
60
- query: refineme is a -> { group_by: ai,astr } -> { group_by: ai, aggregate: ac is count() }
61
- query: checkme is refineme refine { limit: 1 }`;
62
- expect(doc).toTranslate();
63
- const checkme = doc.translator.getQuery('checkme');
64
- expect(checkme).toBeDefined();
65
- if (checkme) {
66
- expect(checkme.pipeline[1]).toMatchObject({ limit: 1 });
67
- }
68
- });
69
- test('order_by goes into the last segment', () => {
70
- const doc = (0, test_translator_1.model) `
71
- query: refineme is a -> { group_by: ai,astr } -> { group_by: ai, aggregate: ac is count() }
72
- query: checkme is refineme refine { order_by: 2 }`;
73
- expect(doc).toTranslate();
74
- const checkme = doc.translator.getQuery('checkme');
75
- expect(checkme).toBeDefined();
76
- if (checkme) {
77
- expect(checkme.pipeline[1]).toHaveProperty('orderBy');
78
- }
79
- });
80
- const stageErr = 'Illegal in refinement of a query with more than one stage';
81
- test('group_by illegal in long pipes', () => {
82
- expect((0, test_translator_1.markSource) `query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
83
- query: checkme is refineme refine { ${'group_by: stage'} }`).translationToFailWith(stageErr);
84
- });
85
- test('aggregate illegal in long pipes', () => {
86
- expect((0, test_translator_1.markSource) `query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
87
- query: checkme is refineme refine { ${'aggregate: c is count()'} }`).translationToFailWith(stageErr);
88
- });
89
- test('calcluate illegal in long pipes', () => {
90
- expect((0, test_translator_1.markSource) `query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
91
- query: checkme is refineme refine { ${'calculate: c is count()'} }`).translationToFailWith(stageErr);
92
- });
93
- test('extend illegal in long pipes', () => {
94
- expect((0, test_translator_1.markSource) `query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
95
- query: checkme is refineme refine { ${'extend: {measure: c is count()}'} }`).translationToFailWith(stageErr);
96
- });
97
- test('nest illegal in long pipes', () => {
98
- expect((0, test_translator_1.markSource) `query: refineme is a -> { project: stage is "stage1" } -> { project: stage is "stage2" }
99
- query: checkme is refineme refine { ${'nest: b is {group_by: stage}'} }`).translationToFailWith(stageErr);
100
- });
101
- test('all single stage refinements are accepted', () => {
102
- expect((0, test_translator_1.markSource) `query: refineme is a -> { group_by: stage is "stage1" }
103
- query: checkme is refineme refine {
104
- extend: { dimension: red is 'red' }
105
- nest: nestRed is { group_by: red }
106
- group_by: ai
107
- aggregate: counted is count()
108
- calculate: l is lag(ai)
109
- }`).toTranslate();
110
- });
111
- });
112
- //# sourceMappingURL=refine.spec.js.map
@@ -1,155 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- require("./parse-expects");
26
- const parse_utils_1 = require("../parse-utils");
27
- const test_translator_1 = require("./test-translator");
28
- describe('quote comprehension inside strings', () => {
29
- test('\\b', () => {
30
- expect((0, parse_utils_1.parseString)('\\b')).toEqual('\b');
31
- });
32
- test('\\f', () => {
33
- expect((0, parse_utils_1.parseString)('\\f')).toEqual('\f');
34
- });
35
- test('\\n', () => {
36
- expect((0, parse_utils_1.parseString)('\\n')).toEqual('\n');
37
- });
38
- test('\\r', () => {
39
- expect((0, parse_utils_1.parseString)('\\r')).toEqual('\r');
40
- });
41
- test('\\t', () => {
42
- expect((0, parse_utils_1.parseString)('\\t')).toEqual('\t');
43
- });
44
- test('unicode ?', () => {
45
- expect((0, parse_utils_1.parseString)('\\u003f')).toEqual('?');
46
- expect((0, parse_utils_1.parseString)('\\u003F')).toEqual('?');
47
- });
48
- test('normal stuff', () => {
49
- expect((0, parse_utils_1.parseString)('normal stuff')).toEqual('normal stuff');
50
- });
51
- test('stuff & nonsense', () => {
52
- expect((0, parse_utils_1.parseString)('stuff \\u0026 nonsense')).toEqual('stuff & nonsense');
53
- });
54
- test('one thing\\nnext thing', () => {
55
- expect((0, parse_utils_1.parseString)('one thing\\nnext thing')).toEqual('one thing\nnext thing');
56
- });
57
- test('quote stripping works', () => {
58
- expect((0, parse_utils_1.parseString)('|42|', '|')).toEqual('42');
59
- });
60
- });
61
- describe('string parsing in language', () => {
62
- const tz = 'America/Mexico_City';
63
- test('multi-line indent increasing', () => {
64
- const checking = new test_translator_1.BetaExpression(`"""
65
- left
66
- mid
67
- right
68
- """`);
69
- expect(checking).toTranslate();
70
- const v = checking.generated().value[0];
71
- expect(v).toMatchObject({ literal: '\nleft\n mid\n right\n' });
72
- });
73
- test('multi-line indent decreasing', () => {
74
- const checking = new test_translator_1.BetaExpression(`"""
75
- right
76
- mid
77
- left
78
- """`);
79
- expect(checking).toTranslate();
80
- const v = checking.generated().value[0];
81
- expect(v).toMatchObject({ literal: '\n right\n mid\nleft\n' });
82
- });
83
- test('multi-line indent keep', () => {
84
- const checking = new test_translator_1.BetaExpression(`"""right
85
- mid
86
- left"""`);
87
- expect(checking).toTranslate();
88
- const v = checking.generated().value[0];
89
- expect(v).toMatchObject({ literal: 'right\n mid\n left' });
90
- });
91
- test('timezone single quote', () => {
92
- const m = new test_translator_1.TestTranslator(`run: a-> {timezone: '${tz}'; project: *}`);
93
- expect(m).toParse();
94
- });
95
- test('timezone double quote', () => {
96
- const m = new test_translator_1.TestTranslator(`run: a-> {timezone: "${tz}"; project: *}`);
97
- expect(m).toParse();
98
- });
99
- test('timezone triple quote', () => {
100
- const m = new test_translator_1.TestTranslator(`run: a->{timezone: """${tz}"""; project: *}`);
101
- expect(m).toParse();
102
- });
103
- test('timezone with illegal query', () => {
104
- expect(`run: a->{timezone: """${tz}%{ab->aturtle}"""; project: *}`).translationToFailWith('%{ query } illegal in this string');
105
- });
106
- test('table single quote', () => {
107
- const m = new test_translator_1.TestTranslator("source: n is bigquery.table('n')");
108
- expect(m).toParse();
109
- });
110
- test('table double quote', () => {
111
- const m = new test_translator_1.TestTranslator('source: n is bigquery.table("n")');
112
- expect(m).toParse();
113
- });
114
- test('table triple quote', () => {
115
- const m = new test_translator_1.TestTranslator('source: n is bigquery.table("""n""")');
116
- expect(m).toParse();
117
- });
118
- test('sql single quote', () => {
119
- const m = new test_translator_1.TestTranslator("source: n is bigquery.sql('n')");
120
- expect(m).toParse();
121
- });
122
- test('sql double quote', () => {
123
- const m = new test_translator_1.TestTranslator('source: n is bigquery.sql("n")');
124
- expect(m).toParse();
125
- });
126
- test('sql triple quote', () => {
127
- const m = new test_translator_1.TestTranslator('source: n is bigquery.sql("""n""")');
128
- expect(m).toParse();
129
- });
130
- test('import single quote', () => {
131
- const m = new test_translator_1.TestTranslator("import 'a'");
132
- expect(m).toParse();
133
- });
134
- test('import double quote', () => {
135
- const m = new test_translator_1.TestTranslator('import "a"');
136
- expect(m).toParse();
137
- });
138
- test('import triple quote', () => {
139
- const m = new test_translator_1.TestTranslator('import """a"""');
140
- expect(m).toParse();
141
- });
142
- test('literal single quote', () => {
143
- const x = new test_translator_1.BetaExpression("'x'");
144
- expect(x).toParse();
145
- });
146
- test('literal double quote', () => {
147
- const x = new test_translator_1.BetaExpression('"x"');
148
- expect(x).toParse();
149
- });
150
- test('literal triple quote', () => {
151
- const x = new test_translator_1.BetaExpression('"""x"""');
152
- expect(x).toParse();
153
- });
154
- });
155
- //# sourceMappingURL=strings.spec.js.map