-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more fold-related edge cases to the test suite.
- Loading branch information
1 parent
2611481
commit 25a7692
Showing
20 changed files
with
1,294 additions
and
0 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
.../valid_queries/fold_with_both_count_and_nested_filter_dependent_on_tag.graphql-parsed.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
Ok(TestParsedGraphQLQuery( | ||
schema_name: "numbers", | ||
query: Query( | ||
root_connection: FieldConnection( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "One", | ||
), | ||
root_field: FieldNode( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "One", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "value", | ||
), FieldNode( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "value", | ||
output: [ | ||
OutputDirective(), | ||
], | ||
tag: [ | ||
TagDirective(), | ||
], | ||
)), | ||
(FieldConnection( | ||
position: Pos( | ||
line: 6, | ||
column: 9, | ||
), | ||
name: "successor", | ||
), FieldNode( | ||
position: Pos( | ||
line: 6, | ||
column: 9, | ||
), | ||
name: "successor", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 7, | ||
column: 13, | ||
), | ||
name: "predecessor", | ||
fold: Some(FoldGroup( | ||
fold: FoldDirective(), | ||
transform: Some(TransformGroup( | ||
transform: TransformDirective( | ||
kind: Count, | ||
), | ||
filter: [ | ||
FilterDirective( | ||
operation: GreaterThanOrEqual((), TagRef("value")), | ||
), | ||
], | ||
)), | ||
)), | ||
), FieldNode( | ||
position: Pos( | ||
line: 7, | ||
column: 13, | ||
), | ||
name: "predecessor", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 8, | ||
column: 17, | ||
), | ||
name: "value", | ||
), FieldNode( | ||
position: Pos( | ||
line: 8, | ||
column: 17, | ||
), | ||
name: "value", | ||
filter: [ | ||
FilterDirective( | ||
operation: Equals((), TagRef("value")), | ||
), | ||
], | ||
output: [ | ||
OutputDirective(), | ||
], | ||
)), | ||
], | ||
transform_group: Some(TransformGroup( | ||
transform: TransformDirective( | ||
kind: Count, | ||
), | ||
filter: [ | ||
FilterDirective( | ||
operation: GreaterThanOrEqual((), TagRef("value")), | ||
), | ||
], | ||
)), | ||
)), | ||
], | ||
)), | ||
], | ||
), | ||
), | ||
)) |
19 changes: 19 additions & 0 deletions
19
...a/tests/valid_queries/fold_with_both_count_and_nested_filter_dependent_on_tag.graphql.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
TestGraphQLQuery ( | ||
schema_name: "numbers", | ||
// When resolving `One` or its `successor` edge, the `value` property inside `predecessor` | ||
// now has a known value: if it isn't the number 1, then the result set will be discarded | ||
// by the fold-count-filter sequence. | ||
query: r#" | ||
{ | ||
One { | ||
value @tag @output | ||
successor { | ||
predecessor @fold @transform(op: "count") @filter(op: ">=", value: ["%value"]) { | ||
value @filter(op: "=", value: ["%value"]) @output | ||
} | ||
} | ||
} | ||
}"#, | ||
arguments: {}, | ||
) |
8 changes: 8 additions & 0 deletions
8
...t_data/tests/valid_queries/fold_with_both_count_and_nested_filter_dependent_on_tag.ir.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Err(MultipleOutputsWithSameName(DuplicatedNamesConflict( | ||
duplicates: { | ||
"value": [ | ||
("Number", "value"), | ||
("Number", "value"), | ||
], | ||
}, | ||
))) |
Empty file.
95 changes: 95 additions & 0 deletions
95
...test_data/tests/valid_queries/fold_with_count_filter_and_nested_filter.graphql-parsed.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Ok(TestParsedGraphQLQuery( | ||
schema_name: "numbers", | ||
query: Query( | ||
root_connection: FieldConnection( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "One", | ||
), | ||
root_field: FieldNode( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "One", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "successor", | ||
), FieldNode( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "successor", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 5, | ||
column: 13, | ||
), | ||
name: "predecessor", | ||
fold: Some(FoldGroup( | ||
fold: FoldDirective(), | ||
transform: Some(TransformGroup( | ||
transform: TransformDirective( | ||
kind: Count, | ||
), | ||
filter: [ | ||
FilterDirective( | ||
operation: GreaterThanOrEqual((), VariableRef("one")), | ||
), | ||
], | ||
)), | ||
)), | ||
), FieldNode( | ||
position: Pos( | ||
line: 5, | ||
column: 13, | ||
), | ||
name: "predecessor", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 6, | ||
column: 17, | ||
), | ||
name: "value", | ||
), FieldNode( | ||
position: Pos( | ||
line: 6, | ||
column: 17, | ||
), | ||
name: "value", | ||
filter: [ | ||
FilterDirective( | ||
operation: Equals((), VariableRef("one")), | ||
), | ||
], | ||
)), | ||
], | ||
transform_group: Some(TransformGroup( | ||
transform: TransformDirective( | ||
kind: Count, | ||
), | ||
filter: [ | ||
FilterDirective( | ||
operation: GreaterThanOrEqual((), VariableRef("one")), | ||
), | ||
], | ||
)), | ||
)), | ||
], | ||
)), | ||
], | ||
), | ||
), | ||
arguments: { | ||
"one": Int64(1), | ||
}, | ||
)) |
19 changes: 19 additions & 0 deletions
19
...l_core/test_data/tests/valid_queries/fold_with_count_filter_and_nested_filter.graphql.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
TestGraphQLQuery ( | ||
schema_name: "numbers", | ||
// When resolving `One` or its `successor` edge, the `value` property inside `predecessor` | ||
// now has a known value: if it isn't the number 1, then the result set will be discarded | ||
// by the fold-count-filter sequence. | ||
query: r#" | ||
{ | ||
One { | ||
successor { | ||
predecessor @fold @transform(op: "count") @filter(op: ">=", value: ["$one"]) { | ||
value @filter(op: "=", value: ["$one"]) @output | ||
} | ||
} | ||
} | ||
}"#, | ||
arguments: { | ||
"one": Int64(1), | ||
}, | ||
) |
65 changes: 65 additions & 0 deletions
65
trustfall_core/test_data/tests/valid_queries/fold_with_count_filter_and_nested_filter.ir.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Ok(TestIRQuery( | ||
schema_name: "numbers", | ||
ir_query: IRQuery( | ||
root_name: "One", | ||
root_component: IRQueryComponent( | ||
root: Vid(1), | ||
vertices: { | ||
Vid(1): IRVertex( | ||
vid: Vid(1), | ||
type_name: "Number", | ||
), | ||
Vid(2): IRVertex( | ||
vid: Vid(2), | ||
type_name: "Number", | ||
), | ||
}, | ||
edges: { | ||
Eid(1): IREdge( | ||
eid: Eid(1), | ||
from_vid: Vid(1), | ||
to_vid: Vid(2), | ||
edge_name: "successor", | ||
), | ||
}, | ||
folds: { | ||
Eid(2): IRFold( | ||
eid: Eid(2), | ||
from_vid: Vid(2), | ||
to_vid: Vid(3), | ||
edge_name: "predecessor", | ||
component: IRQueryComponent( | ||
root: Vid(3), | ||
vertices: { | ||
Vid(3): IRVertex( | ||
vid: Vid(3), | ||
type_name: "Number", | ||
filters: [ | ||
Equals(LocalField( | ||
field_name: "value", | ||
field_type: "Int", | ||
), Variable(VariableRef( | ||
variable_name: "one", | ||
variable_type: "Int", | ||
))), | ||
], | ||
), | ||
}, | ||
), | ||
post_filters: [ | ||
GreaterThanOrEqual(Count, Variable(VariableRef( | ||
variable_name: "one", | ||
variable_type: "Int!", | ||
))), | ||
], | ||
), | ||
}, | ||
), | ||
variables: { | ||
"one": "Int!", | ||
}, | ||
), | ||
arguments: { | ||
"one": Int64(1), | ||
}, | ||
)) |
Oops, something went wrong.