diff --git a/bsc-plugin/CHANGELOG.md b/bsc-plugin/CHANGELOG.md index 4ba6fbf9..8b344762 100644 --- a/bsc-plugin/CHANGELOG.md +++ b/bsc-plugin/CHANGELOG.md @@ -4,10 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [5.4.0](https://github.com/georgejecook/rooibos/compare/5.3.5...5.4.0) +#### [5.4.1](https://github.com/georgejecook/rooibos/compare/5.4.0...5.4.1) -- Renames global timer var for uniqueness [`#211`](https://github.com/georgejecook/rooibos/pull/211) +- bump [`4889580`](https://github.com/georgejecook/rooibos/commit/48895803ea3c503b9fc7d139ade3269f061767e0) + +#### [5.4.0](https://github.com/georgejecook/rooibos/compare/5.3.6...5.4.0) + +> 21 February 2023 + +- Fix/crash stagingdir [`#215`](https://github.com/georgejecook/rooibos/pull/215) - bump [`ddb57d4`](https://github.com/georgejecook/rooibos/commit/ddb57d40c256e002dfb2e442a1c69dfec2222693) + +#### [5.3.6](https://github.com/georgejecook/rooibos/compare/5.3.5...5.3.6) + +> 26 January 2023 + +- Renames global timer var for uniqueness [`#211`](https://github.com/georgejecook/rooibos/pull/211) - bump [`445521b`](https://github.com/georgejecook/rooibos/commit/445521ba8801731fd628f3aab922cf74116ee509) #### [5.3.5](https://github.com/georgejecook/rooibos/compare/5.3.4...5.3.5) diff --git a/bsc-plugin/package.json b/bsc-plugin/package.json index 5cf5ff93..b192c841 100644 --- a/bsc-plugin/package.json +++ b/bsc-plugin/package.json @@ -1,6 +1,6 @@ { "name": "rooibos-roku", - "version": "5.4.0", + "version": "5.4.1", "description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin", "repository": { "type": "git", @@ -110,4 +110,4 @@ "ts" ] } -} +} \ No newline at end of file diff --git a/framework/src/source/CommonUtils.bs b/framework/src/source/CommonUtils.bs index a98c825c..dd25db8d 100755 --- a/framework/src/source/CommonUtils.bs +++ b/framework/src/source/CommonUtils.bs @@ -523,7 +523,11 @@ namespace rooibos.Common ' * @param {Boolean} caseSensitive - indicates if comparisons are case sensitive ' * @returns {Integer} - element index if array contains a value, else return -1 ' */ - function findElementIndexInArray(array, value, compareAttribute = invalid, caseSensitive = false) as integer + function findElementIndexInArray(array, value, compareAttribute = invalid, caseSensitive = false, callCount = 0) as integer + if callCount = 0 and not Rooibos.Common.isArray(array) + array = Rooibos.Common.asArray(array) + end if + if Rooibos.Common.isArray(array) for i = 0 to Rooibos.Common.asArray(array).Count() - 1 compareValue = array[i] @@ -532,7 +536,7 @@ namespace rooibos.Common compareValue = compareValue.lookupCI(compareAttribute) end if - if Rooibos.Common.eqValues(compareValue, value) + if Rooibos.Common.eqValues(compareValue, value, callCount + 1) return i end if next @@ -638,7 +642,12 @@ namespace rooibos.Common ' * @param {Dynamic} Value2 - second item to compare ' * @returns {boolean} - True if values are equal or False in other case. ' */ - function eqValues(Value1, Value2, fuzzy = false) as dynamic + function eqValues(Value1, Value2, fuzzy = false, callCount = 0) as dynamic + if callCount > 10 + ? "REACHED MAX ITERATIONS DOING COMPARISON" + return true + end if + ' Workaraund for bug with string boxing, and box everything else val1Type = Rooibos.Common.getSafeType(Value1) val2Type = Rooibos.Common.getSafeType(Value2) @@ -660,11 +669,11 @@ namespace rooibos.Common valtype = val1Type if val1Type = "List" - return Rooibos.Common.eqArray(Value1, Value2, fuzzy) + return Rooibos.Common.eqArray(Value1, Value2, fuzzy, callCount + 1) else if valtype = "roAssociativeArray" - return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy) + return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy, callCount + 1) else if valtype = "roArray" - return Rooibos.Common.eqArray(Value1, Value2, fuzzy) + return Rooibos.Common.eqArray(Value1, Value2, fuzzy, callCount + 1) else if valtype = "roSGNode" if val2Type <> "roSGNode" return false @@ -713,7 +722,7 @@ namespace rooibos.Common ' * @param {Dynamic} Value2 - second associative array ' * @returns {boolean} - True if arrays are equal or False in other case. ' */ - function eqAssocArray(Value1, Value2, fuzzy = false) as dynamic + function eqAssocArray(Value1, Value2, fuzzy = false, callCount = 0) as dynamic l1 = Value1.Count() l2 = Value2.Count() @@ -727,7 +736,7 @@ namespace rooibos.Common if rooibos.common.canSafelyIterateAAKey(Value1, k) and rooibos.common.canSafelyIterateAAKey(Value2, k) v1 = Value1[k] v2 = Value2[k] - if not Rooibos.Common.eqValues(v1, v2, fuzzy) + if not Rooibos.Common.eqValues(v1, v2, fuzzy, callCount + 1) return false end if end if @@ -738,7 +747,7 @@ namespace rooibos.Common end function function canSafelyIterateAAKey(aa, key) as boolean - if lcase(key) = "__rooibosskipfields" or key = "__mocks" or key = "__stubs" 'fix infinite loop/box crash when doing equals on an aa with a mock + if lcase(key) = "__rooibosskipfields" or key = "__mocks" or key = "__stubs" or key = "log" or key = "top" or key = "m" 'fix infinite loop/box crash when doing equals on an aa with a mock return false else if aa.__rooibosSkipFields <> invalid and aa.__rooibosSkipFields.doesExist(key) return false @@ -757,7 +766,11 @@ namespace rooibos.Common ' * @param {Dynamic} Value2 - second array ' * @returns {boolean} - True if arrays are equal or False in other case. ' */ - function eqArray(Value1, Value2, fuzzy = false) as dynamic + function eqArray(Value1, Value2, fuzzy = false, callCount = 0) as dynamic + if callCount > 30 + ? "REACHED MAX ITERATIONS DOING COMPARISON" + return true + end if if not (Rooibos.Common.isArray(Value1)) or not Rooibos.Common.isArray(Value2) return false end if @@ -771,7 +784,7 @@ namespace rooibos.Common for i = 0 to l1 - 1 v1 = Value1[i] v2 = Value2[i] - if not Rooibos.Common.eqValues(v1, v2, fuzzy) + if not Rooibos.Common.eqValues(v1, v2, fuzzy, callCount + 1) return false end if end for