-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings - Fixes for whitespaces and comments, added unit tests #1622
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 @@ | ||
// ----------------------------------------------------------------------------- | ||
// Automatically generated by 'functions_config.rb' | ||
// DO NOT MANUALLY EDIT THIS FILE! | ||
// ----------------------------------------------------------------------------- | ||
#define DEBUG_MODE_FULL | ||
#include "script_component.hpp" | ||
|
||
#define TESTS ["parse"] | ||
|
||
SCRIPT(test-settings); | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
LOG("=== Testing Settings ==="); | ||
|
||
{ | ||
private _test = execVM format ["\x\cba\addons\settings\test_%1.sqf", _x]; | ||
waitUntil { scriptDone _test }; | ||
} forEach TESTS; |
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,94 @@ | ||
// ---------------------------------------------------------------------------- | ||
#define DEBUG_MODE_FULL | ||
#include "script_component.hpp" | ||
|
||
SCRIPT(test_settings); | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
private ["_funcName", "_settings", "_result"]; | ||
|
||
LOG('Testing Settings'); | ||
|
||
// UNIT TESTS (parse) | ||
_funcName = QFUNC(parse); | ||
TEST_DEFINED(QFUNC(parse),""); | ||
|
||
// Purposely weird formatting, must remain this way because newlines remain part of result | ||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_regular.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["ace_advanced_ballistics_ammoTemperatureEnabled", true, 0], | ||
["ace_advanced_ballistics_barrelLengthInfluenceEnabled", false, 2], | ||
["ace_advanced_ballistics_bulletTraceEnabled", true, 1], | ||
["ace_advanced_fatigue_enabled", false, 0], | ||
["ace_advanced_fatigue_enableStaminaBar", true, 0], | ||
["ace_advanced_fatigue_performanceFactor", 1, 1], | ||
["ace_advanced_fatigue_terrainGradientFactor", 1, 2] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_multiline.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "[ | ||
"" item_1 "", | ||
"" item_2 "" | ||
]", 0], | ||
["test2", "[ | ||
' item_1 ', | ||
' item_2 ' | ||
]", 1], | ||
["test3", "[ | ||
' item_1 ' , "" item_2 "" | ||
]", 2], | ||
["test4", " | ||
|
||
[ | ||
'"" item_1 ""', | ||
' item_2 ' | ||
] | ||
|
||
", 0] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_unicode.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [["test1", "[Āā, Ăă, Ҙ, привет]", 1]]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (preprocessFile "x\cba\addons\settings\test_settings_strings.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "", 0], | ||
["test2", "", 0], | ||
["test3", " T E S T " , 0], | ||
["test4", " T E S T ", 0], | ||
["test5", "[ ' t e s t ' , "" T E S T "" ]", 0], | ||
["test6", "[ "" t e s t "" , | ||
|
||
"""" T E S T """" ]", 0], | ||
["test7", "[ true, false ]", 0], | ||
["test8", "[ "" item_1 "" , "" item_2 "" ]", 0], | ||
["test9", "[ ' item_1 ' , ' item_2 ' ]", 0], | ||
["test10", "[ ' item_1 ' , "" item_2 "" ]", 0], | ||
["test11", "[ '"" item_1 ""' , ' item_2 ' ]", 0], | ||
["test12", "[ ' item_1 ' , ""' item_2 '"" ]", 0] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
// Don't preprocess for testing comments | ||
_settings = (loadFile "x\cba\addons\settings\test_settings_comments.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test2", "[true,false]", 1], | ||
["test4", "[ ' t e s t ' , "" T E S T "" ]", 0], | ||
["ace_advanced_ballistics_ammoTemperatureEnabled", true, 0], | ||
["ace_advanced_ballistics_barrelLengthInfluenceEnabled", true, 2], | ||
["ace_advanced_ballistics_bulletTraceEnabled", true, 1] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
_settings = (loadFile "x\cba\addons\settings\test_settings_comments_eof.sqf") call FUNC(parse); | ||
_result = _settings isEqualTo [ | ||
["test1", "[""item_1"",""item_2""]", 1] | ||
]; | ||
TEST_TRUE(_result,_funcName); | ||
|
||
nil |
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,35 @@ | ||
/* | ||
force test1 = "[""item_1"",""item_2""]"; | ||
*/ | ||
|
||
force test2 = "[true,false]"; | ||
/* | ||
//forceforceforce = true;//"[""ACE_DAGR"",""ACE_microDAGR""]"; | ||
*/ | ||
|
||
//test3 = "[Āā,Ăă,Ҙ,привет]"; | ||
test4 = "[ ' t e s t ' , "" T E S T "" ]"; | ||
/* | ||
test5 = '[ " t e s t ", | ||
|
||
"" T E S T "" ]'; | ||
test6 = ''; // "settings,"; | ||
test7 = " T S T "; | ||
*/ | ||
|
||
|
||
// ACE Advanced Ballistics | ||
ace_advanced_ballistics_ammoTemperatureEnabled = true; | ||
force force ace_advanced_ballistics_barrelLengthInfluenceEnabled = true; | ||
force ace_advanced_ballistics_bulletTraceEnabled = true; | ||
|
||
// ACE Advanced Fatigue | ||
/*/* | ||
ace_advanced_fatigue_enabled = true; | ||
ace_advanced_fatigue_enableStaminaBar = true; | ||
/* | ||
force ace_advanced_fatigue_performanceFactor = 1; | ||
force force ace_advanced_fatigue_terrainGradientFactor = 1; | ||
*/ | ||
|
||
// End of file |
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,5 @@ | ||
force test1 = "[""item_1"",""item_2""]"; | ||
|
||
// ACE Advanced Fatigue | ||
/* | ||
force test2 = "[true,false]"; |
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,28 @@ | ||
test1 = "[ | ||
"" item_1 "", | ||
"" item_2 "" | ||
]"; | ||
|
||
force test2 = "[ | ||
' item_1 ', | ||
' item_2 ' | ||
]"; | ||
|
||
force force test3 = | ||
|
||
"[ | ||
' item_1 ' , "" item_2 "" | ||
]" | ||
|
||
; | ||
|
||
test4 = " | ||
|
||
[ | ||
'"" item_1 ""', | ||
' item_2 ' | ||
] | ||
|
||
" | ||
|
||
; |
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,10 @@ | ||
// ACE Advanced Ballistics | ||
ace_advanced_ballistics_ammoTemperatureEnabled = true; | ||
force force ace_advanced_ballistics_barrelLengthInfluenceEnabled = false; | ||
force ace_advanced_ballistics_bulletTraceEnabled = true; | ||
|
||
// ACE Advanced Fatigue | ||
ace_advanced_fatigue_enabled = false; | ||
ace_advanced_fatigue_enableStaminaBar = true; | ||
force ace_advanced_fatigue_performanceFactor = 1; | ||
force force ace_advanced_fatigue_terrainGradientFactor = 1; |
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,25 @@ | ||
test1 = ""; | ||
|
||
test2 = ''; | ||
|
||
test3 = ' T E S T '; | ||
|
||
test4 = " T E S T "; | ||
|
||
test5 = "[ ' t e s t ' , "" T E S T "" ]"; | ||
|
||
test6 = '[ " t e s t " , | ||
|
||
"" T E S T "" ]'; | ||
|
||
test7 = "[ true, false ]"; | ||
|
||
test8 = "[ "" item_1 "" , "" item_2 "" ]"; | ||
|
||
test9 = "[ ' item_1 ' , ' item_2 ' ]"; | ||
|
||
test10 = "[ ' item_1 ' , "" item_2 "" ]"; | ||
|
||
test11 = "[ '"" item_1 ""' , ' item_2 ' ]"; | ||
|
||
test12 = "[ ' item_1 ' , ""' item_2 '"" ]"; |
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 @@ | ||
force test1 = "[Āā, Ăă, Ҙ, привет]"; |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs inside or outside of the strings? I saw the github action complained about tabs, but I want the tests to run with tabs (to make sure they work - unless that's unnecessary?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I see now. @PabstMirror do we have a way to ignore validating parts of code?
I don't think we need to test for tabs though, as whitespace is whitespace to Arma, but I may be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passing CI now