-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub let() yaml and convert tests to yaml
- Loading branch information
Nolan Woods
committed
May 15, 2022
1 parent
2c84241
commit 427423b
Showing
3 changed files
with
67 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
examples: | ||
with_filters: | ||
context: | ||
search_for: foo | ||
people: [name: a, name: b, name: c, name: foo, name: bar, name: baz, name: qux, | ||
name: x, name: y, name: z] | ||
args: [{search_for: search_for}, '&people[?name==search_for].name | [0]'] | ||
returns: foo | ||
comment: Let function with filters | ||
basic1: | ||
context: &data | ||
a: {mylist: [{l1: '1', result: foo}, {l2: '2', result: bar}, {l1: '8', l2: '9'}, | ||
{l1: '8', l2: '9'}], level2: '2'} | ||
level1: '1' | ||
nested: {a: {b: {c: {fourth: fourth}, third: third}, second: second}, first: first} | ||
precedence: {a: {b: {c: {variable: fourth}, variable: third, other: y}, variable: second, | ||
other: x}, variable: first, other: w} | ||
args: [{level1: level1}, '&a.[level2', 'level1]'] | ||
returns: ['2', '1'] | ||
comment: Basic let from scope | ||
precedence: | ||
context: *data | ||
args: [{level1: "'other'"}, '&level1'] | ||
returns: '1' | ||
comment: Current object has precedence | ||
literal1: | ||
context: *data | ||
args: ['`{}`', '&a.level2'] | ||
returns: '2' | ||
comment: No scope specified using literal hash | ||
basic2: | ||
context: *data | ||
args: [{foo: "'anything'"}, '&[level1, foo]'] | ||
returns: ['1', anything] | ||
comment: Arbitrary variable added | ||
basic3: | ||
context: *data | ||
args: [{other: level1}, '&level1'] | ||
returns: '1' | ||
comment: Basic let from current object | ||
nested1: | ||
context: *data | ||
args: [{level1: level1}, '&a.[mylist[?l1==level1].result, let({level2: level2}, &mylist[?l2==level2].result)]'] | ||
returns: [foo, bar] | ||
comment: Nested let function with filters | ||
nested2: | ||
context: *data | ||
args: ['`{"level1": "1"}`', '&a.[mylist[?l1==level1].result, let({level2: level2}, &mylist[?l2==level2].result)]'] | ||
returns: [foo, bar] | ||
comment: Nested let function with filters with literal scope binding |
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