Skip to content

Commit

Permalink
update snaps?
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Oct 20, 2024
1 parent c3bf7a1 commit 1878680
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libs/sqf/tests/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn optimize(file: &str) -> Statements {
.unwrap();
let source = workspace.join(format!("{file}.sqf")).unwrap();
let processed = Processor::run(&source).unwrap();
hemtt_sqf::parser::run(&Database::a3(false), &processed)
.unwrap()
.optimize()
let mut sqf = hemtt_sqf::parser::run(&Database::a3(false), &processed).unwrap();
sqf.testing_clear_issues();
sqf.optimize()
}
4 changes: 2 additions & 2 deletions libs/sqf/tests/snapshots/lints__simple_s06_find_in_str.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: libs/sqf/tests/lints.rs
expression: lint(stringify! (s06_find_in_str))
expression: "lint(stringify! (s06_find_in_str), true)"
---
help[L-S06]: string search using `in` is faster than `find`
┌─ s06_find_in_str.sqf:1:1
Expand All @@ -17,4 +17,4 @@ expression: lint(stringify! (s06_find_in_str))
2 │ private _hasBar = things find "bar" > -1;
│ ^^^^^^^^^^^^^^^^^^^^^^ using `find` with -1
│
[0m[36m=[0m [32mtry[0m: "bar" in _things
[0m[36m=[0m [32mtry[0m: "bar" in things
3 changes: 3 additions & 0 deletions libs/sqf/tests/snapshots/optimizer__simple_consume_array.snap
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ Statements {
],
source: "1;2;3;4;",
span: 247..255,
issues: [],
},
),
Code(
Expand All @@ -326,6 +327,7 @@ Statements {
],
source: "-1;-2;",
span: 265..271,
issues: [],
},
),
],
Expand Down Expand Up @@ -380,4 +382,5 @@ Statements {
],
source: "params [\"_a\", \"_b\"];\n\nparams [\"_a\", \"_b\", [\"_c\", []]];\n\nmissionNamespace getVariable [\"a\", -1];\n\nz setVariable [\"b\", [], true];\n\n[1,0] vectorAdd p;\n\npositionCameraToWorld [10000, 0, 10000];\n\n\nrandom [0, _x, 1];\n\nprivate _z = if (time > 10) then { 1;2;3;4; } else { -1;-2; };\n\nparam [\"_d\"];\n\n[] param [\"_e\"];\n",
span: 0..307,
issues: [],
}
1 change: 1 addition & 0 deletions libs/sqf/tests/snapshots/optimizer__simple_scalar.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Statements {
],
source: "-5;\n",
span: 0..3,
issues: [],
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ Statements {
],
source: "1 + (2 * 2) + (36 % 31) + (36 / 6) + (sqrt 100) - 3;\n\nsqrt -100;\n\n\nz + z;\n",
span: 0..73,
issues: [],
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Statements {
],
source: "toLower \"A\" + toUpper \"b\" + toUpperAnsi \"C\" + toLowerAnsi \"d\";\n",
span: 0..62,
issues: [],
}
8 changes: 8 additions & 0 deletions libs/sqf/tests/snapshots/simple__simple_eventhandler-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ expression: ast
],
source: "deleteVehicle _x",
span: 3..19,
issues: [],
},
),
NularCommand(
Expand Down Expand Up @@ -110,6 +111,7 @@ expression: ast
],
source: "alive _x",
span: 115..123,
issues: [],
},
),
106..112,
Expand Down Expand Up @@ -140,6 +142,7 @@ expression: ast
],
source: "deleteVehicle _x;",
span: 149..166,
issues: [],
},
),
NularCommand(
Expand All @@ -155,6 +158,7 @@ expression: ast
],
source: "allPlayers findIf { alive _x };\n {\n deleteVehicle _x;\n } forEach allPlayers;",
span: 95..196,
issues: [],
},
),
80..84,
Expand All @@ -164,6 +168,7 @@ expression: ast
],
source: "if (alive player) then {\n allPlayers findIf { alive _x };\n {\n deleteVehicle _x;\n } forEach allPlayers;\n };",
span: 62..203,
issues: [],
},
),
],
Expand Down Expand Up @@ -242,6 +247,7 @@ expression: ast
],
source: "deleteVehicle _x",
span: 294..310,
issues: [],
},
),
NularCommand(
Expand All @@ -257,6 +263,7 @@ expression: ast
],
source: "{ deleteVehicle _x } count allPlayers;",
span: 292..330,
issues: [],
},
),
277..281,
Expand All @@ -266,6 +273,7 @@ expression: ast
],
source: "if (alive player) then {\n { deleteVehicle _x } count allPlayers;\n };",
span: 259..337,
issues: [],
},
),
],
Expand Down
3 changes: 3 additions & 0 deletions libs/sqf/tests/snapshots/simple__simple_foreach-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ expression: ast
],
source: "deleteVehicle _x;",
span: 7..24,
issues: [],
},
),
NularCommand(
Expand Down Expand Up @@ -106,6 +107,7 @@ expression: ast
],
source: "_x setDamage 1;",
span: 97..112,
issues: [],
},
),
UnaryCommand(
Expand All @@ -125,6 +127,7 @@ expression: ast
],
source: "systemChat format [\"%1\", _x];\n {\n _x setDamage 1;\n } forEach crew _x;",
span: 53..135,
issues: [],
},
),
NularCommand(
Expand Down
2 changes: 2 additions & 0 deletions libs/sqf/tests/snapshots/simple__simple_get_visibility-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ expression: ast
],
source: "_arg1 = [eyePos _arg1, _arg1]",
span: 66..95,
issues: [],
},
),
59..63,
Expand Down Expand Up @@ -151,6 +152,7 @@ expression: ast
],
source: "_arg2 = [eyePos _arg2, _arg2]",
span: 138..167,
issues: [],
},
),
131..135,
Expand Down
1 change: 1 addition & 0 deletions libs/sqf/tests/snapshots/simple__simple_include-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ expression: ast
],
source: "private thinghi = _x + \"test\";",
span: 94..124,
issues: [],
},
),
Array(
Expand Down
1 change: 1 addition & 0 deletions libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ expression: ast
],
source: "systemChat \"this is a test\";",
span: 153..181,
issues: [],
},
),
136..140,
Expand Down

0 comments on commit 1878680

Please sign in to comment.