File tree Expand file tree Collapse file tree 2 files changed +72
-3
lines changed
Expand file tree Collapse file tree 2 files changed +72
-3
lines changed Original file line number Diff line number Diff line change 2323 "- query: SELECT * FROM info()",
2424 "- query: |",
2525 " SELECT A",
26- " FROM scope()"
26+ " FROM scope()",
27+ ""
2728 ],
2829 "export reformatted": [
2930 "",
3031 "name: Exported",
3132 "export: |",
3233 " SELECT *",
33- " FROM scope()"
34+ " FROM scope()",
35+ ""
3436 ],
3537 "preconditions": [
3638 "",
3941 "sources:",
4042 "- precondition: |",
4143 " SELECT *",
42- " FROM info()"
44+ " FROM info()",
45+ ""
46+ ],
47+ "notebook": [
48+ "",
49+ "name: Notebook",
50+ "sources:",
51+ "- query: |",
52+ " SELECT A,",
53+ " B,",
54+ " C",
55+ " FROM scope()",
56+ " notebook:",
57+ " - name: Test",
58+ " type: vql_suggestion",
59+ " template: |",
60+ " SELECT * FROM scope()",
61+ ""
62+ ],
63+ "column types": [
64+ "",
65+ "name: Column Types",
66+ "sources:",
67+ "- query: |",
68+ " SELECT A,",
69+ " B,",
70+ " C",
71+ " FROM scope()",
72+ "column_types:",
73+ " - name: A",
74+ " type: string",
75+ ""
4376 ]
4477}
Original file line number Diff line number Diff line change @@ -47,6 +47,30 @@ precondition: SELECT * FROM info()
4747sources:
4848- precondition: |
4949 SELECT * FROM info()
50+ ` }, {
51+ name : "notebook" ,
52+ in : `
53+ name: Notebook
54+ sources:
55+ - query: |
56+ SELECT A,B,C
57+ FROM scope()
58+ notebook:
59+ - name: Test
60+ type: vql_suggestion
61+ template: |
62+ SELECT * FROM scope()
63+ ` }, {
64+ name : "column types" ,
65+ in : `
66+ name: Column Types
67+ sources:
68+ - query: |
69+ SELECT A,B,C
70+ FROM scope()
71+ column_types:
72+ - name: A
73+ type: string
5074` },
5175}
5276
@@ -59,3 +83,15 @@ func TestReformat(t *testing.T) {
5983 }
6084 goldie .AssertJson (t , "TestReformat" , golden )
6185}
86+
87+ // Test that when VQL is reformatted multiple times it doesn't change.
88+ func TestReformatMultiple (t * testing.T ) {
89+ golden := ordereddict .NewDict ()
90+ for _ , c := range reformatCases {
91+ first , err := reformatVQL (c .in )
92+ second , err := reformatVQL (first )
93+ assert .NoError (t , err )
94+ golden .Set (c .name , strings .Split (second , "\n " ))
95+ }
96+ goldie .AssertJson (t , "TestReformat" , golden )
97+ }
You can’t perform that action at this time.
0 commit comments