rooibos-roku 5.4.1 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -523,7 +523,11 @@ namespace rooibos.Common
523
523
  ' * @param {Boolean} caseSensitive - indicates if comparisons are case sensitive
524
524
  ' * @returns {Integer} - element index if array contains a value, else return -1
525
525
  ' */
526
- function findElementIndexInArray(array, value, compareAttribute = invalid, caseSensitive = false) as integer
526
+ function findElementIndexInArray(array, value, compareAttribute = invalid, caseSensitive = false, callCount = 0) as integer
527
+ if callCount = 0 and not Rooibos.Common.isArray(array)
528
+ array = Rooibos.Common.asArray(array)
529
+ end if
530
+
527
531
  if Rooibos.Common.isArray(array)
528
532
  for i = 0 to Rooibos.Common.asArray(array).Count() - 1
529
533
  compareValue = array[i]
@@ -532,7 +536,7 @@ namespace rooibos.Common
532
536
  compareValue = compareValue.lookupCI(compareAttribute)
533
537
  end if
534
538
 
535
- if Rooibos.Common.eqValues(compareValue, value)
539
+ if Rooibos.Common.eqValues(compareValue, value, callCount + 1)
536
540
  return i
537
541
  end if
538
542
  next
@@ -638,7 +642,12 @@ namespace rooibos.Common
638
642
  ' * @param {Dynamic} Value2 - second item to compare
639
643
  ' * @returns {boolean} - True if values are equal or False in other case.
640
644
  ' */
641
- function eqValues(Value1, Value2, fuzzy = false) as dynamic
645
+ function eqValues(Value1, Value2, fuzzy = false, callCount = 0) as dynamic
646
+ if callCount > 10
647
+ ? "REACHED MAX ITERATIONS DOING COMPARISON"
648
+ return true
649
+ end if
650
+
642
651
  ' Workaraund for bug with string boxing, and box everything else
643
652
  val1Type = Rooibos.Common.getSafeType(Value1)
644
653
  val2Type = Rooibos.Common.getSafeType(Value2)
@@ -660,11 +669,11 @@ namespace rooibos.Common
660
669
  valtype = val1Type
661
670
 
662
671
  if val1Type = "List"
663
- return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
672
+ return Rooibos.Common.eqArray(Value1, Value2, fuzzy, callCount + 1)
664
673
  else if valtype = "roAssociativeArray"
665
- return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy)
674
+ return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy, callCount + 1)
666
675
  else if valtype = "roArray"
667
- return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
676
+ return Rooibos.Common.eqArray(Value1, Value2, fuzzy, callCount + 1)
668
677
  else if valtype = "roSGNode"
669
678
  if val2Type <> "roSGNode"
670
679
  return false
@@ -713,7 +722,7 @@ namespace rooibos.Common
713
722
  ' * @param {Dynamic} Value2 - second associative array
714
723
  ' * @returns {boolean} - True if arrays are equal or False in other case.
715
724
  ' */
716
- function eqAssocArray(Value1, Value2, fuzzy = false) as dynamic
725
+ function eqAssocArray(Value1, Value2, fuzzy = false, callCount = 0) as dynamic
717
726
  l1 = Value1.Count()
718
727
  l2 = Value2.Count()
719
728
 
@@ -727,7 +736,7 @@ namespace rooibos.Common
727
736
  if rooibos.common.canSafelyIterateAAKey(Value1, k) and rooibos.common.canSafelyIterateAAKey(Value2, k)
728
737
  v1 = Value1[k]
729
738
  v2 = Value2[k]
730
- if not Rooibos.Common.eqValues(v1, v2, fuzzy)
739
+ if not Rooibos.Common.eqValues(v1, v2, fuzzy, callCount + 1)
731
740
  return false
732
741
  end if
733
742
  end if
@@ -738,7 +747,7 @@ namespace rooibos.Common
738
747
  end function
739
748
 
740
749
  function canSafelyIterateAAKey(aa, key) as boolean
741
- if lcase(key) = "__rooibosskipfields" or key = "__mocks" or key = "__stubs" 'fix infinite loop/box crash when doing equals on an aa with a mock
750
+ 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
742
751
  return false
743
752
  else if aa.__rooibosSkipFields <> invalid and aa.__rooibosSkipFields.doesExist(key)
744
753
  return false
@@ -757,7 +766,11 @@ namespace rooibos.Common
757
766
  ' * @param {Dynamic} Value2 - second array
758
767
  ' * @returns {boolean} - True if arrays are equal or False in other case.
759
768
  ' */
760
- function eqArray(Value1, Value2, fuzzy = false) as dynamic
769
+ function eqArray(Value1, Value2, fuzzy = false, callCount = 0) as dynamic
770
+ if callCount > 30
771
+ ? "REACHED MAX ITERATIONS DOING COMPARISON"
772
+ return true
773
+ end if
761
774
  if not (Rooibos.Common.isArray(Value1)) or not Rooibos.Common.isArray(Value2)
762
775
  return false
763
776
  end if
@@ -771,7 +784,7 @@ namespace rooibos.Common
771
784
  for i = 0 to l1 - 1
772
785
  v1 = Value1[i]
773
786
  v2 = Value2[i]
774
- if not Rooibos.Common.eqValues(v1, v2, fuzzy)
787
+ if not Rooibos.Common.eqValues(v1, v2, fuzzy, callCount + 1)
775
788
  return false
776
789
  end if
777
790
  end for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rooibos-roku",
3
- "version": "5.4.1",
3
+ "version": "5.4.2",
4
4
  "description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
5
5
  "repository": {
6
6
  "type": "git",