Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreypopp/9c9953d521de6cae91e463efe3c5c9ca to your computer and use it in GitHub Desktop.
Save andreypopp/9c9953d521de6cae91e463efe3c5c9ca to your computer and use it in GitHub Desktop.
diff --git a/workflows-emodel/print-rel.test.ts b/workflows-emodel/print-rel.test.ts
index d746afe..4901e56 100644
--- a/workflows-emodel/print-rel.test.ts
+++ b/workflows-emodel/print-rel.test.ts
@@ -4,56 +4,104 @@ testReprint("query from table", (code) => {
expect(code).toMatchInlineSnapshot(`"query from table"`);
});
+testReprint("query from ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query from ??"`);
+});
+
testReprint("query alias name", (code) => {
expect(code).toMatchInlineSnapshot(`"query alias name"`);
});
+testReprint("query alias ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query alias ??"`);
+});
+
testReprint("query from users alias u", (code) => {
expect(code).toMatchInlineSnapshot(`"query from users alias u"`);
});
+testReprint("query from ?? alias ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query from ?? alias ??"`);
+});
+
testReprint("query where x", (code) => {
expect(code).toMatchInlineSnapshot(`"query where x"`);
});
+testReprint("query where ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query where ??"`);
+});
+
testReprint("query select x, y, z as zz", (code) => {
expect(code).toMatchInlineSnapshot(`"query select x, y, z as zz"`);
});
+testReprint("query select ??, y as ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select ??, y"`);
+});
+
testReprint("query define x, y, z as zz", (code) => {
expect(code).toMatchInlineSnapshot(`"query define x, y, z as zz"`);
});
+testReprint("query define ??, y as ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query define ??, y"`);
+});
+
testReprint("query group x, y, z as zz", (code) => {
expect(code).toMatchInlineSnapshot(`"query group x, y, z as zz"`);
});
+testReprint("query group ??, y as ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query group ??, y"`);
+});
+
testReprint(
"query join from comments alias c on c.user_id = user_id",
(code) => {
expect(code).toMatchInlineSnapshot(`
-"query join (from comments
-alias c) on c.user_id = user_id"
-`);
+ "query join (from comments
+ alias c) on c.user_id = user_id"
+ `);
}
);
+testReprint("query join from ?? alias ?? on ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query join (from ?? alias ??) on ??"`);
+});
+
testReprint("query join", (code) => {
expect(code).toMatchInlineSnapshot(`"query join (??) on ??"`);
});
+testReprint("query join ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query join (??) on ??"`);
+});
+
testReprint("query select", (code) => {
expect(code).toMatchInlineSnapshot(`"query select ??"`);
});
+testReprint("query select ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select ??"`);
+});
+
testReprint("query define", (code) => {
expect(code).toMatchInlineSnapshot(`"query define ??"`);
});
+testReprint("query define ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query define ??"`);
+});
+
testReprint("query group", (code) => {
expect(code).toMatchInlineSnapshot(`"query group ??"`);
});
+testReprint("query group ??", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query group ??"`);
+});
+
testReprint("query from", (code) => {
expect(code).toMatchInlineSnapshot(`"query from ??"`);
});
@@ -90,13 +138,36 @@ testReprint("query select 1 * (1 + 2)", (code) => {
expect(code).toMatchInlineSnapshot(`"query select 1 * (1 + 2)"`);
});
+testReprint("query select ?? * (1 + ??)", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select ?? * (1 + ??)"`);
+});
+
testReprint("query select -1, not z", (code) => {
expect(code).toMatchInlineSnapshot(`"query select -1, not z"`);
});
+testReprint("query select -??, not z", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select -??, not z"`);
+});
+
testReprint("query select x.y, x.count(), x.z.y, x.(1 + 2)", (code) => {
expect(code).toMatchInlineSnapshot(`
-"query select x.y, x.count(), x.z.y, x.(1
+ "query select x.y, x.count(), x.z.y, x.(1
+ + 2)"
+ `);
+});
+
+testReprint("query select name.??()", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select name.??()"`);
+});
+
+testReprint("query select ??.name()", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select ??.name()"`);
+});
+
+testReprint("query select x.??, ??.count(), x.??.y, ??.(?? + 2)", (code) => {
+ expect(code).toMatchInlineSnapshot(`
+"query select x.??, ??.count(), x.??.y, ??.(??
+ 2)"
`);
});
@@ -104,3 +175,7 @@ testReprint("query select x.y, x.count(), x.z.y, x.(1 + 2)", (code) => {
testReprint("query select count(), exists(from x)", (code) => {
expect(code).toMatchInlineSnapshot(`"query select count(), exists(from x)"`);
});
+
+testReprint("query select count(), exists(??)", (code) => {
+ expect(code).toMatchInlineSnapshot(`"query select count(), exists(??)"`);
+});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment