From 1878680546d3c36b614c8b6ad68a148fccd036b1 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 20 Oct 2024 18:41:42 -0500 Subject: [PATCH] update snaps? --- libs/sqf/tests/optimizer.rs | 6 +++--- .../tests/snapshots/lints__simple_s06_find_in_str.snap | 4 ++-- .../tests/snapshots/optimizer__simple_consume_array.snap | 3 +++ libs/sqf/tests/snapshots/optimizer__simple_scalar.snap | 1 + .../tests/snapshots/optimizer__simple_static_math.snap | 1 + .../tests/snapshots/optimizer__simple_string_case.snap | 1 + .../tests/snapshots/simple__simple_eventhandler-2.snap | 8 ++++++++ libs/sqf/tests/snapshots/simple__simple_foreach-2.snap | 3 +++ .../tests/snapshots/simple__simple_get_visibility-2.snap | 2 ++ libs/sqf/tests/snapshots/simple__simple_include-2.snap | 1 + libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap | 1 + 11 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libs/sqf/tests/optimizer.rs b/libs/sqf/tests/optimizer.rs index 953a5c82..8222e88c 100644 --- a/libs/sqf/tests/optimizer.rs +++ b/libs/sqf/tests/optimizer.rs @@ -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() } diff --git a/libs/sqf/tests/snapshots/lints__simple_s06_find_in_str.snap b/libs/sqf/tests/snapshots/lints__simple_s06_find_in_str.snap index 69e71fcf..9d73e975 100644 --- a/libs/sqf/tests/snapshots/lints__simple_s06_find_in_str.snap +++ b/libs/sqf/tests/snapshots/lints__simple_s06_find_in_str.snap @@ -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 @@ -17,4 +17,4 @@ expression: lint(stringify! (s06_find_in_str)) 2 │ private _hasBar = things find "bar" > -1; │ ^^^^^^^^^^^^^^^^^^^^^^ using `find` with -1 │ - = try: "bar" in _things + = try: "bar" in things diff --git a/libs/sqf/tests/snapshots/optimizer__simple_consume_array.snap b/libs/sqf/tests/snapshots/optimizer__simple_consume_array.snap index 3ea53afb..41eb91d6 100644 --- a/libs/sqf/tests/snapshots/optimizer__simple_consume_array.snap +++ b/libs/sqf/tests/snapshots/optimizer__simple_consume_array.snap @@ -300,6 +300,7 @@ Statements { ], source: "1;2;3;4;", span: 247..255, + issues: [], }, ), Code( @@ -326,6 +327,7 @@ Statements { ], source: "-1;-2;", span: 265..271, + issues: [], }, ), ], @@ -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: [], } diff --git a/libs/sqf/tests/snapshots/optimizer__simple_scalar.snap b/libs/sqf/tests/snapshots/optimizer__simple_scalar.snap index a1551d85..01cb2780 100644 --- a/libs/sqf/tests/snapshots/optimizer__simple_scalar.snap +++ b/libs/sqf/tests/snapshots/optimizer__simple_scalar.snap @@ -16,4 +16,5 @@ Statements { ], source: "-5;\n", span: 0..3, + issues: [], } diff --git a/libs/sqf/tests/snapshots/optimizer__simple_static_math.snap b/libs/sqf/tests/snapshots/optimizer__simple_static_math.snap index 0110c807..bd12765d 100644 --- a/libs/sqf/tests/snapshots/optimizer__simple_static_math.snap +++ b/libs/sqf/tests/snapshots/optimizer__simple_static_math.snap @@ -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: [], } diff --git a/libs/sqf/tests/snapshots/optimizer__simple_string_case.snap b/libs/sqf/tests/snapshots/optimizer__simple_string_case.snap index e81e8564..3e6cabd8 100644 --- a/libs/sqf/tests/snapshots/optimizer__simple_string_case.snap +++ b/libs/sqf/tests/snapshots/optimizer__simple_string_case.snap @@ -15,4 +15,5 @@ Statements { ], source: "toLower \"A\" + toUpper \"b\" + toUpperAnsi \"C\" + toLowerAnsi \"d\";\n", span: 0..62, + issues: [], } diff --git a/libs/sqf/tests/snapshots/simple__simple_eventhandler-2.snap b/libs/sqf/tests/snapshots/simple__simple_eventhandler-2.snap index e09ece6f..09537998 100644 --- a/libs/sqf/tests/snapshots/simple__simple_eventhandler-2.snap +++ b/libs/sqf/tests/snapshots/simple__simple_eventhandler-2.snap @@ -27,6 +27,7 @@ expression: ast ], source: "deleteVehicle _x", span: 3..19, + issues: [], }, ), NularCommand( @@ -110,6 +111,7 @@ expression: ast ], source: "alive _x", span: 115..123, + issues: [], }, ), 106..112, @@ -140,6 +142,7 @@ expression: ast ], source: "deleteVehicle _x;", span: 149..166, + issues: [], }, ), NularCommand( @@ -155,6 +158,7 @@ expression: ast ], source: "allPlayers findIf { alive _x };\n {\n deleteVehicle _x;\n } forEach allPlayers;", span: 95..196, + issues: [], }, ), 80..84, @@ -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: [], }, ), ], @@ -242,6 +247,7 @@ expression: ast ], source: "deleteVehicle _x", span: 294..310, + issues: [], }, ), NularCommand( @@ -257,6 +263,7 @@ expression: ast ], source: "{ deleteVehicle _x } count allPlayers;", span: 292..330, + issues: [], }, ), 277..281, @@ -266,6 +273,7 @@ expression: ast ], source: "if (alive player) then {\n { deleteVehicle _x } count allPlayers;\n };", span: 259..337, + issues: [], }, ), ], diff --git a/libs/sqf/tests/snapshots/simple__simple_foreach-2.snap b/libs/sqf/tests/snapshots/simple__simple_foreach-2.snap index 24bc3e96..96cab024 100644 --- a/libs/sqf/tests/snapshots/simple__simple_foreach-2.snap +++ b/libs/sqf/tests/snapshots/simple__simple_foreach-2.snap @@ -27,6 +27,7 @@ expression: ast ], source: "deleteVehicle _x;", span: 7..24, + issues: [], }, ), NularCommand( @@ -106,6 +107,7 @@ expression: ast ], source: "_x setDamage 1;", span: 97..112, + issues: [], }, ), UnaryCommand( @@ -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( diff --git a/libs/sqf/tests/snapshots/simple__simple_get_visibility-2.snap b/libs/sqf/tests/snapshots/simple__simple_get_visibility-2.snap index 0e168ddf..3c935a5e 100644 --- a/libs/sqf/tests/snapshots/simple__simple_get_visibility-2.snap +++ b/libs/sqf/tests/snapshots/simple__simple_get_visibility-2.snap @@ -86,6 +86,7 @@ expression: ast ], source: "_arg1 = [eyePos _arg1, _arg1]", span: 66..95, + issues: [], }, ), 59..63, @@ -151,6 +152,7 @@ expression: ast ], source: "_arg2 = [eyePos _arg2, _arg2]", span: 138..167, + issues: [], }, ), 131..135, diff --git a/libs/sqf/tests/snapshots/simple__simple_include-2.snap b/libs/sqf/tests/snapshots/simple__simple_include-2.snap index 726ce909..1adfd6f8 100644 --- a/libs/sqf/tests/snapshots/simple__simple_include-2.snap +++ b/libs/sqf/tests/snapshots/simple__simple_include-2.snap @@ -130,6 +130,7 @@ expression: ast ], source: "private thinghi = _x + \"test\";", span: 94..124, + issues: [], }, ), Array( diff --git a/libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap b/libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap index ede82283..a982af3d 100644 --- a/libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap +++ b/libs/sqf/tests/snapshots/simple__simple_semicolons-2.snap @@ -78,6 +78,7 @@ expression: ast ], source: "systemChat \"this is a test\";", span: 153..181, + issues: [], }, ), 136..140,