@malloydata/malloy-tests 0.0.242-dev250313002313 → 0.0.242-dev250313045635
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.
package/package.json
CHANGED
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@jest/globals": "^29.4.3",
|
|
24
|
-
"@malloydata/db-bigquery": "^0.0.242-
|
|
25
|
-
"@malloydata/db-duckdb": "^0.0.242-
|
|
26
|
-
"@malloydata/db-postgres": "^0.0.242-
|
|
27
|
-
"@malloydata/db-snowflake": "^0.0.242-
|
|
28
|
-
"@malloydata/db-trino": "^0.0.242-
|
|
29
|
-
"@malloydata/malloy": "^0.0.242-
|
|
30
|
-
"@malloydata/malloy-tag": "^0.0.242-
|
|
31
|
-
"@malloydata/render": "^0.0.242-
|
|
24
|
+
"@malloydata/db-bigquery": "^0.0.242-dev250313045635",
|
|
25
|
+
"@malloydata/db-duckdb": "^0.0.242-dev250313045635",
|
|
26
|
+
"@malloydata/db-postgres": "^0.0.242-dev250313045635",
|
|
27
|
+
"@malloydata/db-snowflake": "^0.0.242-dev250313045635",
|
|
28
|
+
"@malloydata/db-trino": "^0.0.242-dev250313045635",
|
|
29
|
+
"@malloydata/malloy": "^0.0.242-dev250313045635",
|
|
30
|
+
"@malloydata/malloy-tag": "^0.0.242-dev250313045635",
|
|
31
|
+
"@malloydata/render": "^0.0.242-dev250313045635",
|
|
32
32
|
"events": "^3.3.0",
|
|
33
33
|
"jsdom": "^22.1.0",
|
|
34
34
|
"luxon": "^2.4.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@types/jsdom": "^21.1.1",
|
|
39
39
|
"@types/luxon": "^2.4.0"
|
|
40
40
|
},
|
|
41
|
-
"version": "0.0.242-
|
|
41
|
+
"version": "0.0.242-dev250313045635"
|
|
42
42
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {RuntimeList, allDatabases} from '../../runtimes';
|
|
9
|
+
import '../../util/db-jest-matchers';
|
|
10
|
+
import {databasesFromEnvironmentOr} from '../../util';
|
|
11
|
+
|
|
12
|
+
const runtimes = new RuntimeList(databasesFromEnvironmentOr(allDatabases));
|
|
13
|
+
|
|
14
|
+
afterAll(async () => {
|
|
15
|
+
await runtimes.closeAll();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe.each(runtimes.runtimeList)('filter expressions %s', (dbName, db) => {
|
|
19
|
+
const q = db.getQuoter();
|
|
20
|
+
const abc = db.loadModel(`
|
|
21
|
+
source: abc is ${dbName}.sql("""
|
|
22
|
+
SELECT 'abc' as ${q`s`}, '0 - abc' as ${q`nm`}
|
|
23
|
+
UNION ALL SELECT 'def', '1 - def'
|
|
24
|
+
UNION ALL SELECT null, '2 - null'
|
|
25
|
+
UNION ALL SELECT '', '3 - empty'
|
|
26
|
+
""")
|
|
27
|
+
`);
|
|
28
|
+
|
|
29
|
+
test('abc', async () => {
|
|
30
|
+
await expect(`
|
|
31
|
+
run: abc -> {
|
|
32
|
+
where: s ~ f'abc';
|
|
33
|
+
select: s
|
|
34
|
+
}`).malloyResultMatches(abc, [{s: 'abc'}]);
|
|
35
|
+
});
|
|
36
|
+
test('abc,def', async () => {
|
|
37
|
+
await expect(`
|
|
38
|
+
run: abc -> {
|
|
39
|
+
where: s ~ f'abc,def';
|
|
40
|
+
select: nm; order_by: nm
|
|
41
|
+
}`).malloyResultMatches(abc, [{nm: '0 - abc'}, {nm: '1 - def'}]);
|
|
42
|
+
});
|
|
43
|
+
test('-abc', async () => {
|
|
44
|
+
await expect(`
|
|
45
|
+
run: abc -> {
|
|
46
|
+
where: s ~ f'-abc',
|
|
47
|
+
select: nm; order_by: nm asc
|
|
48
|
+
}`).malloyResultMatches(abc, [
|
|
49
|
+
{nm: '1 - def'},
|
|
50
|
+
{nm: '2 - null'},
|
|
51
|
+
{nm: '3 - empty'},
|
|
52
|
+
]);
|
|
53
|
+
});
|
|
54
|
+
test('-starts', async () => {
|
|
55
|
+
await expect(`
|
|
56
|
+
run: abc -> {
|
|
57
|
+
where: s ~ f'-a%',
|
|
58
|
+
select: nm; order_by: nm asc
|
|
59
|
+
}`).malloyResultMatches(abc, [
|
|
60
|
+
{nm: '1 - def'},
|
|
61
|
+
{nm: '2 - null'},
|
|
62
|
+
{nm: '3 - empty'},
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
test('-contains', async () => {
|
|
66
|
+
await expect(`
|
|
67
|
+
run: abc -> {
|
|
68
|
+
where: s ~ f'-%b%',
|
|
69
|
+
select: nm; order_by: nm asc
|
|
70
|
+
}`).malloyResultMatches(abc, [
|
|
71
|
+
{nm: '1 - def'},
|
|
72
|
+
{nm: '2 - null'},
|
|
73
|
+
{nm: '3 - empty'},
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
test('-end', async () => {
|
|
77
|
+
await expect(`
|
|
78
|
+
run: abc -> {
|
|
79
|
+
where: s ~ f'-%c',
|
|
80
|
+
select: nm; order_by: nm asc
|
|
81
|
+
}`).malloyResultMatches(abc, [
|
|
82
|
+
{nm: '1 - def'},
|
|
83
|
+
{nm: '2 - null'},
|
|
84
|
+
{nm: '3 - empty'},
|
|
85
|
+
]);
|
|
86
|
+
});
|
|
87
|
+
test('unlike', async () => {
|
|
88
|
+
await expect(`
|
|
89
|
+
run: abc -> {
|
|
90
|
+
where: s ~ f'-a%c',
|
|
91
|
+
select: nm; order_by: nm asc
|
|
92
|
+
}`).malloyResultMatches(abc, [
|
|
93
|
+
{nm: '1 - def'},
|
|
94
|
+
{nm: '2 - null'},
|
|
95
|
+
{nm: '3 - empty'},
|
|
96
|
+
]);
|
|
97
|
+
});
|
|
98
|
+
test('simple but not _%,-abc', async () => {
|
|
99
|
+
await expect(`
|
|
100
|
+
run: abc -> {
|
|
101
|
+
where: s ~ f'_%,-abc';
|
|
102
|
+
select: s
|
|
103
|
+
}`).malloyResultMatches(abc, [{s: 'def'}]);
|
|
104
|
+
});
|
|
105
|
+
test('empty', async () => {
|
|
106
|
+
await expect(`
|
|
107
|
+
run: abc -> {
|
|
108
|
+
where: s ~ f'empty'
|
|
109
|
+
select: nm; order_by: nm asc
|
|
110
|
+
}`).malloyResultMatches(abc, [{nm: '2 - null'}, {nm: '3 - empty'}]);
|
|
111
|
+
});
|
|
112
|
+
test('-empty', async () => {
|
|
113
|
+
await expect(`
|
|
114
|
+
run: abc -> {
|
|
115
|
+
where: s ~ f'-empty'
|
|
116
|
+
select: nm; order_by: nm asc
|
|
117
|
+
}`).malloyResultMatches(abc, [{nm: '0 - abc'}, {nm: '1 - def'}]);
|
|
118
|
+
});
|
|
119
|
+
test('null', async () => {
|
|
120
|
+
await expect(`
|
|
121
|
+
run: abc -> {
|
|
122
|
+
where: s ~ f'null'
|
|
123
|
+
select: nm
|
|
124
|
+
}`).malloyResultMatches(abc, [{nm: '2 - null'}]);
|
|
125
|
+
});
|
|
126
|
+
test('-null', async () => {
|
|
127
|
+
await expect(`
|
|
128
|
+
run: abc -> {
|
|
129
|
+
where: s ~ f'-null'
|
|
130
|
+
select: nm; order_by: nm asc
|
|
131
|
+
}`).malloyResultMatches(abc, [
|
|
132
|
+
{nm: '0 - abc'},
|
|
133
|
+
{nm: '1 - def'},
|
|
134
|
+
{nm: '3 - empty'},
|
|
135
|
+
]);
|
|
136
|
+
});
|
|
137
|
+
test('starts', async () => {
|
|
138
|
+
await expect(`
|
|
139
|
+
run: abc -> {
|
|
140
|
+
where: s ~ f'a%';
|
|
141
|
+
select: s
|
|
142
|
+
}`).malloyResultMatches(abc, [{s: 'abc'}]);
|
|
143
|
+
});
|
|
144
|
+
test('contains', async () => {
|
|
145
|
+
await expect(`
|
|
146
|
+
run: abc -> {
|
|
147
|
+
where: s ~ f'%b%,%e%';
|
|
148
|
+
select: s; order_by: s asc
|
|
149
|
+
}`).malloyResultMatches(abc, [{s: 'abc'}, {s: 'def'}]);
|
|
150
|
+
});
|
|
151
|
+
test('ends', async () => {
|
|
152
|
+
await expect(`
|
|
153
|
+
run: abc -> {
|
|
154
|
+
where: s ~ f'%c';
|
|
155
|
+
select: s
|
|
156
|
+
}`).malloyResultMatches(abc, [{s: 'abc'}]);
|
|
157
|
+
});
|
|
158
|
+
});
|