rooibos-roku 4.8.2 → 5.0.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.
- package/dist/lib/framework/BaseTestSuite.bs +27 -27
- package/dist/lib/framework/CommonUtils.bs +57 -22
- package/dist/lib/rooibos/FileFactory.js +38 -35
- package/dist/lib/rooibos/FileFactory.js.map +1 -1
- package/dist/lib/rooibos/RawCodeStatement.js +5 -1
- package/dist/lib/rooibos/RawCodeStatement.js.map +1 -1
- package/dist/lib/rooibos/RooibosSession.js +77 -72
- package/dist/lib/rooibos/RooibosSession.js.map +1 -1
- package/dist/lib/rooibos/RooibosSessionInfo.js +22 -0
- package/dist/lib/rooibos/RooibosSessionInfo.js.map +1 -1
- package/dist/lib/rooibos/TestGroup.js +26 -24
- package/dist/lib/rooibos/TestGroup.js.map +1 -1
- package/dist/lib/rooibos/TestSuite.js +2 -8
- package/dist/lib/rooibos/TestSuite.js.map +1 -1
- package/dist/lib/rooibos/TestSuiteBuilder.spec.js +674 -674
- package/dist/lib/rooibos/TestSuiteBuilder.spec.js.map +1 -1
- package/dist/lib/rooibos/Utils.js +27 -125
- package/dist/lib/rooibos/Utils.js.map +1 -1
- package/dist/plugin.js +11 -13
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -3
|
@@ -263,8 +263,8 @@ namespace rooibos
|
|
|
263
263
|
try
|
|
264
264
|
if not Rooibos.Common.eqValues(first, second)
|
|
265
265
|
if msg = ""
|
|
266
|
-
first_as_string = Rooibos.Common.asString(first)
|
|
267
|
-
second_as_string = Rooibos.Common.asString(second)
|
|
266
|
+
first_as_string = Rooibos.Common.asString(first, true)
|
|
267
|
+
second_as_string = Rooibos.Common.asString(second, true)
|
|
268
268
|
msg = first_as_string + " != " + second_as_string
|
|
269
269
|
end if
|
|
270
270
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
@@ -295,7 +295,7 @@ namespace rooibos
|
|
|
295
295
|
return false
|
|
296
296
|
end if
|
|
297
297
|
try
|
|
298
|
-
if first
|
|
298
|
+
if not Rooibos.Common.eqValues(first, second, true)
|
|
299
299
|
if msg = ""
|
|
300
300
|
first_as_string = Rooibos.Common.asString(first)
|
|
301
301
|
second_as_string = Rooibos.Common.asString(second)
|
|
@@ -331,8 +331,8 @@ namespace rooibos
|
|
|
331
331
|
try
|
|
332
332
|
if Rooibos.Common.eqValues(first, second)
|
|
333
333
|
if msg = ""
|
|
334
|
-
first_as_string = Rooibos.Common.asString(first)
|
|
335
|
-
second_as_string = Rooibos.Common.asString(second)
|
|
334
|
+
first_as_string = Rooibos.Common.asString(first, true)
|
|
335
|
+
second_as_string = Rooibos.Common.asString(second, true)
|
|
336
336
|
msg = first_as_string + " == " + second_as_string
|
|
337
337
|
end if
|
|
338
338
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
@@ -365,7 +365,7 @@ namespace rooibos
|
|
|
365
365
|
try
|
|
366
366
|
if value <> invalid
|
|
367
367
|
if msg = ""
|
|
368
|
-
expr_as_string = Rooibos.Common.asString(value)
|
|
368
|
+
expr_as_string = Rooibos.Common.asString(value, true)
|
|
369
369
|
msg = expr_as_string + " <> Invalid"
|
|
370
370
|
end if
|
|
371
371
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
@@ -590,7 +590,7 @@ namespace rooibos
|
|
|
590
590
|
try
|
|
591
591
|
if Rooibos.Common.isAssociativeArray(array) or Rooibos.Common.isArray(array)
|
|
592
592
|
if not Rooibos.Common.arrayContains(array, value, key)
|
|
593
|
-
msg = "Array doesn't have the '" + Rooibos.Common.asString(value) + "' value."
|
|
593
|
+
msg = "Array doesn't have the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
594
594
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
595
595
|
return false
|
|
596
596
|
end if
|
|
@@ -634,7 +634,7 @@ namespace rooibos
|
|
|
634
634
|
for each value in values
|
|
635
635
|
isMatched = false
|
|
636
636
|
if not Rooibos.Common.isAssociativeArray(value)
|
|
637
|
-
msg = "Value to search for was not associativeArray " + Rooibos.Common.asString(value)
|
|
637
|
+
msg = "Value to search for was not associativeArray " + Rooibos.Common.asString(value, true)
|
|
638
638
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
639
639
|
return false
|
|
640
640
|
end if
|
|
@@ -657,7 +657,7 @@ namespace rooibos
|
|
|
657
657
|
end for ' items in array
|
|
658
658
|
|
|
659
659
|
if not isMatched
|
|
660
|
-
msg = "array missing value: " + Rooibos.Common.asString(value)
|
|
660
|
+
msg = "array missing value: " + Rooibos.Common.asString(value, true)
|
|
661
661
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
662
662
|
return false
|
|
663
663
|
end if
|
|
@@ -697,7 +697,7 @@ namespace rooibos
|
|
|
697
697
|
try
|
|
698
698
|
if Rooibos.Common.isAssociativeArray(array) or Rooibos.Common.isArray(array)
|
|
699
699
|
if Rooibos.Common.arrayContains(array, value, key)
|
|
700
|
-
msg = "Array has the '" + Rooibos.Common.asString(value) + "' value."
|
|
700
|
+
msg = "Array has the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
701
701
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
702
702
|
return false
|
|
703
703
|
end if
|
|
@@ -741,7 +741,7 @@ namespace rooibos
|
|
|
741
741
|
value = subset[key]
|
|
742
742
|
end if
|
|
743
743
|
if not Rooibos.Common.arrayContains(array, value, key)
|
|
744
|
-
msg = "Array doesn't have the '" + Rooibos.Common.asString(value) + "' value."
|
|
744
|
+
msg = "Array doesn't have the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
745
745
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
746
746
|
return false
|
|
747
747
|
end if
|
|
@@ -786,7 +786,7 @@ namespace rooibos
|
|
|
786
786
|
value = item[key]
|
|
787
787
|
end if
|
|
788
788
|
if Rooibos.Common.arrayContains(array, value, key)
|
|
789
|
-
msg = "Array has the '" + Rooibos.Common.asString(value) + "' value."
|
|
789
|
+
msg = "Array has the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
790
790
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
791
791
|
return false
|
|
792
792
|
end if
|
|
@@ -900,7 +900,7 @@ namespace rooibos
|
|
|
900
900
|
end if
|
|
901
901
|
else if Rooibos.Common.isString(item)
|
|
902
902
|
if Rooibos.Common.asString(item) <> ""
|
|
903
|
-
msg = "
|
|
903
|
+
msg = "String is not empty, contains: " + Rooibos.Common.asString(item, true)
|
|
904
904
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
905
905
|
return false
|
|
906
906
|
end if
|
|
@@ -988,7 +988,7 @@ namespace rooibos
|
|
|
988
988
|
if typeCheckFunction <> invalid
|
|
989
989
|
for each item in array
|
|
990
990
|
if not typeCheckFunction(item)
|
|
991
|
-
msg = Rooibos.Common.asString(item) + "is not a '" + typeStr + "' type."
|
|
991
|
+
msg = Rooibos.Common.asString(item, true) + " is not a '" + typeStr + "' type."
|
|
992
992
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
993
993
|
return false
|
|
994
994
|
end if
|
|
@@ -1066,7 +1066,7 @@ namespace rooibos
|
|
|
1066
1066
|
try
|
|
1067
1067
|
if type(value) <> typeStr
|
|
1068
1068
|
if msg = ""
|
|
1069
|
-
expr_as_string = Rooibos.Common.asString(value)
|
|
1069
|
+
expr_as_string = Rooibos.Common.asString(value, true)
|
|
1070
1070
|
msg = expr_as_string + " was not expected type " + typeStr
|
|
1071
1071
|
end if
|
|
1072
1072
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
@@ -1099,14 +1099,14 @@ namespace rooibos
|
|
|
1099
1099
|
try
|
|
1100
1100
|
if type(value) <> "roSGNode"
|
|
1101
1101
|
if msg = ""
|
|
1102
|
-
expr_as_string = Rooibos.Common.asString(value)
|
|
1102
|
+
expr_as_string = Rooibos.Common.asString(value, true)
|
|
1103
1103
|
msg = expr_as_string + " was not a node, so could not match subtype " + typeStr
|
|
1104
1104
|
end if
|
|
1105
1105
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1106
1106
|
return false
|
|
1107
1107
|
else if value.subType() <> typeStr
|
|
1108
1108
|
if msg = ""
|
|
1109
|
-
expr_as_string = Rooibos.Common.asString(value)
|
|
1109
|
+
expr_as_string = Rooibos.Common.asString(value, true)
|
|
1110
1110
|
msg = expr_as_string + "( type : " + value.subType() + ") was not of subType " + typeStr
|
|
1111
1111
|
end if
|
|
1112
1112
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
@@ -1134,10 +1134,10 @@ namespace rooibos
|
|
|
1134
1134
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1135
1135
|
return false
|
|
1136
1136
|
end if
|
|
1137
|
-
className =
|
|
1137
|
+
className = `${value.__classname}`
|
|
1138
1138
|
if className <> typeStr
|
|
1139
1139
|
if msg = ""
|
|
1140
|
-
msg =
|
|
1140
|
+
msg = `Expected class: ${typeStr} got ${className}`
|
|
1141
1141
|
end if
|
|
1142
1142
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1143
1143
|
return false
|
|
@@ -1308,7 +1308,7 @@ namespace rooibos
|
|
|
1308
1308
|
try
|
|
1309
1309
|
if type(node) = "roSGNode"
|
|
1310
1310
|
if not Rooibos.Common.nodeContains(node, value)
|
|
1311
|
-
msg = "Node doesn't have the '" + Rooibos.Common.asString(value) + "' value."
|
|
1311
|
+
msg = "Node doesn't have the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
1312
1312
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1313
1313
|
return false
|
|
1314
1314
|
end if
|
|
@@ -1344,7 +1344,7 @@ namespace rooibos
|
|
|
1344
1344
|
try
|
|
1345
1345
|
if type(node) = "roSGNode"
|
|
1346
1346
|
if not Rooibos.Common.nodeContains(node, value)
|
|
1347
|
-
msg = "Node doesn't have the '" + Rooibos.Common.asString(value) + "' value."
|
|
1347
|
+
msg = "Node doesn't have the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
1348
1348
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1349
1349
|
return false
|
|
1350
1350
|
else if node.getChildCount() <> 1
|
|
@@ -1385,7 +1385,7 @@ namespace rooibos
|
|
|
1385
1385
|
try
|
|
1386
1386
|
if type(node) = "roSGNode"
|
|
1387
1387
|
if Rooibos.Common.nodeContains(node, value)
|
|
1388
|
-
msg = "Node has the '" + Rooibos.Common.asString(value) + "' value."
|
|
1388
|
+
msg = "Node has the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
1389
1389
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1390
1390
|
return false
|
|
1391
1391
|
end if
|
|
@@ -1427,7 +1427,7 @@ namespace rooibos
|
|
|
1427
1427
|
subsetValue = subset[key]
|
|
1428
1428
|
nodeValue = node[key]
|
|
1429
1429
|
if not Rooibos.Common.eqValues(nodeValue, subsetValue)
|
|
1430
|
-
msg = key + ": Expected '" + Rooibos.Common.asString(subsetValue) + "', got '" + Rooibos.Common.asString(nodeValue) + "'"
|
|
1430
|
+
msg = key + ": Expected '" + Rooibos.Common.asString(subsetValue, true) + "', got '" + Rooibos.Common.asString(nodeValue, true) + "'"
|
|
1431
1431
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1432
1432
|
return false
|
|
1433
1433
|
end if
|
|
@@ -1476,7 +1476,7 @@ namespace rooibos
|
|
|
1476
1476
|
value = item[key]
|
|
1477
1477
|
end if
|
|
1478
1478
|
if Rooibos.Common.nodeContains(node, value)
|
|
1479
|
-
msg = "Node has the '" + Rooibos.Common.asString(value) + "' value."
|
|
1479
|
+
msg = "Node has the '" + Rooibos.Common.asString(value, true) + "' value."
|
|
1480
1480
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1481
1481
|
return false
|
|
1482
1482
|
end if
|
|
@@ -1524,7 +1524,7 @@ namespace rooibos
|
|
|
1524
1524
|
subsetValue = subset[key]
|
|
1525
1525
|
arrayValue = array[key]
|
|
1526
1526
|
if not Rooibos.Common.eqValues(arrayValue, subsetValue)
|
|
1527
|
-
msg = key + ": Expected '" + Rooibos.Common.asString(subsetValue) + "', got '" + Rooibos.Common.asString(arrayValue) + "'"
|
|
1527
|
+
msg = key + ": Expected '" + Rooibos.Common.asString(subsetValue, true) + "', got '" + Rooibos.Common.asString(arrayValue, true) + "'"
|
|
1528
1528
|
m.currentResult.fail(msg, m.currentAssertLineNumber)
|
|
1529
1529
|
return false
|
|
1530
1530
|
end if
|
|
@@ -2022,7 +2022,7 @@ namespace rooibos
|
|
|
2022
2022
|
|
|
2023
2023
|
if isUsingMatcher
|
|
2024
2024
|
if not expected.matcher(value)
|
|
2025
|
-
m.mockFail(mock.lineNumbers[invocationIndex], methodName, "on Invocation #" + stri(invocationIndex).trim() + ", expected arg #" + stri(i).trim() + " to match matching function '" + Rooibos.Common.asString(expected.matcher) + "' got '" + Rooibos.Common.asString(value) + "')")
|
|
2025
|
+
m.mockFail(mock.lineNumbers[invocationIndex], methodName, "on Invocation #" + stri(invocationIndex).trim() + ", expected arg #" + stri(i).trim() + " to match matching function '" + Rooibos.Common.asString(expected.matcher) + "' got '" + Rooibos.Common.asString(value, true) + "')")
|
|
2026
2026
|
m.cleanMocks()
|
|
2027
2027
|
end if
|
|
2028
2028
|
else
|
|
@@ -2031,7 +2031,7 @@ namespace rooibos
|
|
|
2031
2031
|
expected = "[INVALID]"
|
|
2032
2032
|
end if
|
|
2033
2033
|
|
|
2034
|
-
m.mockFail(mock.lineNumbers[invocationIndex], methodName, "on Invocation #" + stri(invocationIndex).trim() + ", expected arg #" + stri(i).trim() + " to be '" + Rooibos.Common.asString(expected) + "' got '" + Rooibos.Common.asString(value) + "')")
|
|
2034
|
+
m.mockFail(mock.lineNumbers[invocationIndex], methodName, "on Invocation #" + stri(invocationIndex).trim() + ", expected arg #" + stri(i).trim() + " to be '" + Rooibos.Common.asString(expected, true) + "' got '" + Rooibos.Common.asString(value, true) + "')")
|
|
2035
2035
|
m.cleanMocks()
|
|
2036
2036
|
return
|
|
2037
2037
|
end if
|
|
@@ -303,15 +303,27 @@ namespace rooibos.Common
|
|
|
303
303
|
' * @param {Dynamic} input - value to check
|
|
304
304
|
' * @returns {String} - converted string
|
|
305
305
|
' */
|
|
306
|
-
function asString(input) as string
|
|
306
|
+
function asString(input, includeType = false) as string
|
|
307
307
|
if Rooibos.Common.isValid(input) = false
|
|
308
|
-
return "
|
|
308
|
+
return "INVALID"
|
|
309
309
|
else if Rooibos.Common.isString(input)
|
|
310
|
-
|
|
310
|
+
if includeType
|
|
311
|
+
return """" + input + """"
|
|
312
|
+
else
|
|
313
|
+
return input
|
|
314
|
+
end if
|
|
311
315
|
else if Rooibos.Common.isInteger(input) or Rooibos.Common.isLongInteger(input) or Rooibos.Common.isBoolean(input)
|
|
312
|
-
|
|
316
|
+
if includeType
|
|
317
|
+
return input.ToStr() + " (" + Rooibos.Common.getSafeType(input) + ")"
|
|
318
|
+
else
|
|
319
|
+
return input.ToStr()
|
|
320
|
+
end if
|
|
313
321
|
else if Rooibos.Common.isFloat(input) or Rooibos.Common.isDouble(input)
|
|
314
|
-
|
|
322
|
+
if includeType
|
|
323
|
+
return Str(input).Trim() + " (" + Rooibos.Common.getSafeType(input) + ")"
|
|
324
|
+
else
|
|
325
|
+
return Str(input).Trim()
|
|
326
|
+
end if
|
|
315
327
|
else if type(input) = "roSGNode"
|
|
316
328
|
return "Node(" + input.subType() + ")"
|
|
317
329
|
else if type(input) = "roAssociativeArray"
|
|
@@ -324,7 +336,7 @@ namespace rooibos.Common
|
|
|
324
336
|
end if
|
|
325
337
|
for each key in input
|
|
326
338
|
if rooibos.Common.canSafelyIterateAAKey(input, key)
|
|
327
|
-
text = text + key + ":" + Rooibos.Common.asString(input[key])
|
|
339
|
+
text = text + key + ":" + Rooibos.Common.asString(input[key], includeType)
|
|
328
340
|
end if
|
|
329
341
|
end for
|
|
330
342
|
text = text + "}"
|
|
@@ -335,7 +347,7 @@ namespace rooibos.Common
|
|
|
335
347
|
maxLen = 500
|
|
336
348
|
for each v in input
|
|
337
349
|
if len(text) < maxLen
|
|
338
|
-
text += join + rooibos.Common.asString(v)
|
|
350
|
+
text += join + rooibos.Common.asString(v, includeType)
|
|
339
351
|
join = ", "
|
|
340
352
|
end if
|
|
341
353
|
end for
|
|
@@ -345,7 +357,7 @@ namespace rooibos.Common
|
|
|
345
357
|
text = text + "]"
|
|
346
358
|
return text
|
|
347
359
|
else if Rooibos.Common.isFunction(input)
|
|
348
|
-
return input.toStr()
|
|
360
|
+
return input.toStr() + "(function)"
|
|
349
361
|
else
|
|
350
362
|
return ""
|
|
351
363
|
end if
|
|
@@ -617,7 +629,7 @@ namespace rooibos.Common
|
|
|
617
629
|
' * @param {Dynamic} Value2 - second item to compare
|
|
618
630
|
' * @returns {boolean} - True if values are equal or False in other case.
|
|
619
631
|
' */
|
|
620
|
-
function eqValues(Value1, Value2) as dynamic
|
|
632
|
+
function eqValues(Value1, Value2, fuzzy = false) as dynamic
|
|
621
633
|
' Workaraund for bug with string boxing, and box everything else
|
|
622
634
|
val1Type = Rooibos.Common.getSafeType(Value1)
|
|
623
635
|
val2Type = Rooibos.Common.getSafeType(Value2)
|
|
@@ -633,17 +645,17 @@ namespace rooibos.Common
|
|
|
633
645
|
Value1 = cdbl(Value1)
|
|
634
646
|
end if
|
|
635
647
|
|
|
636
|
-
if val1Type <> val2Type
|
|
648
|
+
if val1Type <> val2Type and fuzzy <> true
|
|
637
649
|
return false
|
|
638
650
|
else
|
|
639
651
|
valtype = val1Type
|
|
640
652
|
|
|
641
|
-
if
|
|
642
|
-
return Rooibos.Common.eqArray(Value1, Value2)
|
|
653
|
+
if val1Type = "List"
|
|
654
|
+
return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
|
|
643
655
|
else if valtype = "roAssociativeArray"
|
|
644
|
-
return Rooibos.Common.eqAssocArray(Value1, Value2)
|
|
656
|
+
return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy)
|
|
645
657
|
else if valtype = "roArray"
|
|
646
|
-
return Rooibos.Common.eqArray(Value1, Value2)
|
|
658
|
+
return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
|
|
647
659
|
else if valtype = "roSGNode"
|
|
648
660
|
if val2Type <> "roSGNode"
|
|
649
661
|
return false
|
|
@@ -651,14 +663,37 @@ namespace rooibos.Common
|
|
|
651
663
|
return Value1.isSameNode(Value2)
|
|
652
664
|
end if
|
|
653
665
|
else
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
666
|
+
if fuzzy = true
|
|
667
|
+
return Rooibos.Common.asString(Value1) = Rooibos.Common.asString(Value2)
|
|
668
|
+
else
|
|
669
|
+
'If you crashed on this line, then you're trying to compare
|
|
670
|
+
'2 things which can't be compared - check what value1 and value2
|
|
671
|
+
'are in your debug log
|
|
672
|
+
return Value1 = Value2
|
|
673
|
+
end if
|
|
658
674
|
end if
|
|
659
675
|
end if
|
|
660
676
|
end function
|
|
661
677
|
|
|
678
|
+
function eqTypes(Value1, Value2) as dynamic
|
|
679
|
+
val1Type = Rooibos.Common.getSafeType(Value1)
|
|
680
|
+
val2Type = Rooibos.Common.getSafeType(Value2)
|
|
681
|
+
if val1Type = invalid or val2Type = invalid
|
|
682
|
+
? "ERROR!!!! - undefined value passed"
|
|
683
|
+
return false
|
|
684
|
+
end if
|
|
685
|
+
|
|
686
|
+
'Upcast int to float, if other is float
|
|
687
|
+
if val1Type = "Float" and val2Type = "Integer"
|
|
688
|
+
Value2 = cdbl(Value2)
|
|
689
|
+
else if val2Type = "Float" and val1Type = "Integer"
|
|
690
|
+
Value1 = cdbl(Value1)
|
|
691
|
+
end if
|
|
692
|
+
|
|
693
|
+
return val1Type <> val2Type
|
|
694
|
+
end function
|
|
695
|
+
|
|
696
|
+
|
|
662
697
|
' /**
|
|
663
698
|
' * @memberof module:CommonUtils
|
|
664
699
|
' * @name EqAssocArray
|
|
@@ -669,7 +704,7 @@ namespace rooibos.Common
|
|
|
669
704
|
' * @param {Dynamic} Value2 - second associative array
|
|
670
705
|
' * @returns {boolean} - True if arrays are equal or False in other case.
|
|
671
706
|
' */
|
|
672
|
-
function eqAssocArray(Value1, Value2) as dynamic
|
|
707
|
+
function eqAssocArray(Value1, Value2, fuzzy = false) as dynamic
|
|
673
708
|
l1 = Value1.Count()
|
|
674
709
|
l2 = Value2.Count()
|
|
675
710
|
|
|
@@ -683,7 +718,7 @@ namespace rooibos.Common
|
|
|
683
718
|
if rooibos.common.canSafelyIterateAAKey(Value1, k) and rooibos.common.canSafelyIterateAAKey(Value2, k)
|
|
684
719
|
v1 = Value1[k]
|
|
685
720
|
v2 = Value2[k]
|
|
686
|
-
if not Rooibos.Common.eqValues(v1, v2)
|
|
721
|
+
if not Rooibos.Common.eqValues(v1, v2, fuzzy)
|
|
687
722
|
return false
|
|
688
723
|
end if
|
|
689
724
|
end if
|
|
@@ -713,7 +748,7 @@ namespace rooibos.Common
|
|
|
713
748
|
' * @param {Dynamic} Value2 - second array
|
|
714
749
|
' * @returns {boolean} - True if arrays are equal or False in other case.
|
|
715
750
|
' */
|
|
716
|
-
function eqArray(Value1, Value2) as dynamic
|
|
751
|
+
function eqArray(Value1, Value2, fuzzy = false) as dynamic
|
|
717
752
|
if not (Rooibos.Common.isArray(Value1)) or not Rooibos.Common.isArray(Value2)
|
|
718
753
|
return false
|
|
719
754
|
end if
|
|
@@ -727,7 +762,7 @@ namespace rooibos.Common
|
|
|
727
762
|
for i = 0 to l1 - 1
|
|
728
763
|
v1 = Value1[i]
|
|
729
764
|
v2 = Value2[i]
|
|
730
|
-
if not Rooibos.Common.eqValues(v1, v2)
|
|
765
|
+
if not Rooibos.Common.eqValues(v1, v2, fuzzy)
|
|
731
766
|
return false
|
|
732
767
|
end if
|
|
733
768
|
end for
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileFactory = void 0;
|
|
4
|
+
const brighterscript_1 = require("brighterscript");
|
|
4
5
|
const path = require("path");
|
|
5
6
|
const fs = require("fs");
|
|
6
7
|
class FileFactory {
|
|
7
8
|
constructor(options) {
|
|
9
|
+
var _a;
|
|
10
|
+
this.options = options;
|
|
8
11
|
this.frameworkFileNames = [
|
|
9
12
|
'BaseTestSuite',
|
|
10
13
|
'CommonUtils',
|
|
@@ -21,35 +24,34 @@ class FileFactory {
|
|
|
21
24
|
'TestRunner',
|
|
22
25
|
'Utils'
|
|
23
26
|
];
|
|
24
|
-
this.sourcePath = path.join(__dirname, '../framework');
|
|
25
27
|
this.targetPath = 'source/rooibos/';
|
|
26
28
|
this.targetCompsPath = 'components/rooibos/';
|
|
27
29
|
this.addedFrameworkFiles = [];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
this.options = (_a = this.options) !== null && _a !== void 0 ? _a : {};
|
|
31
|
+
if (!this.options.frameworkSourcePath) {
|
|
32
|
+
if (__filename.endsWith('.ts')) {
|
|
33
|
+
//load the files directly from their source location. (i.e. the plugin is running as a typescript file from within ts-node)
|
|
34
|
+
this.options.frameworkSourcePath = brighterscript_1.standardizePath `${__dirname}/../../../../framework/src/source`;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
//load the framework files from the dist folder (i.e. the plugin is running as a node_module)
|
|
38
|
+
this.options.frameworkSourcePath = brighterscript_1.standardizePath `${__dirname}/../framework`;
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
|
-
getFrameworkFiles() {
|
|
34
|
-
let files = [];
|
|
35
|
-
for (let fileName of this.frameworkFileNames) {
|
|
36
|
-
files.push({ src: path.resolve(path.join(this.sourcePath, `${fileName}.bs`)), dest: path.join(this.targetPath, `${fileName}.bs`) });
|
|
37
|
-
}
|
|
38
|
-
files.push({ src: path.resolve(path.join(this.sourcePath, `RooibosScene.xml`)), dest: path.join(this.targetCompsPath, `RooibosScene.xml`) });
|
|
39
|
-
return files;
|
|
40
|
-
}
|
|
41
42
|
addFrameworkFiles(program) {
|
|
42
43
|
this.addedFrameworkFiles = [];
|
|
43
44
|
for (let fileName of this.frameworkFileNames) {
|
|
44
|
-
let sourcePath = path.resolve(path.join(this.
|
|
45
|
+
let sourcePath = path.resolve(path.join(this.options.frameworkSourcePath, `${fileName}.bs`));
|
|
45
46
|
let fileContents = fs.readFileSync(sourcePath, 'utf8');
|
|
46
47
|
let destPath = path.join(this.targetPath, `${fileName}.bs`);
|
|
47
48
|
let entry = { src: sourcePath, dest: destPath };
|
|
48
49
|
this.addedFrameworkFiles.push(program.setFile(entry, fileContents));
|
|
49
50
|
}
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
let entry = {
|
|
52
|
+
src: brighterscript_1.standardizePath `${this.options.frameworkSourcePath}/RooibosScene.xml`,
|
|
53
|
+
dest: brighterscript_1.standardizePath `${this.targetCompsPath}/RooibosScene.xml`
|
|
54
|
+
};
|
|
53
55
|
this.addedFrameworkFiles.push(program.setFile(entry, this.createTestXML('TestsScene', 'Scene')));
|
|
54
56
|
}
|
|
55
57
|
createTestXML(name, baseName, useBs = true) {
|
|
@@ -58,25 +60,23 @@ class FileFactory {
|
|
|
58
60
|
scriptImports.push(`<script type="text/bright${useBs ? 'er' : ''}script" uri="pkg:/${this.targetPath}${fileName}.${useBs ? 'bs' : 'brs'}" />`);
|
|
59
61
|
}
|
|
60
62
|
let contents = `<?xml version="1.0" encoding="UTF-8" ?>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<function name='Rooibos_CreateTestNode' />
|
|
71
|
-
</interface>
|
|
63
|
+
<component name="${name}" extends="${baseName}">
|
|
64
|
+
${scriptImports.join('\n')}
|
|
65
|
+
<interface>
|
|
66
|
+
<field id="rooibosTestResult" type="assocarray"/>
|
|
67
|
+
<field id="testText" type="string" alias="statusLabel.text" />
|
|
68
|
+
<field id="failedText" type="string" alias="failedLabel.text" />
|
|
69
|
+
<field id="statusColor" type="string" alias="statusBackground.color" />
|
|
70
|
+
<function name='Rooibos_CreateTestNode' />
|
|
71
|
+
</interface>
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
<children>
|
|
74
|
+
<Rectangle id="statusBackground" color="#444444" width="1920" height="1080" />
|
|
75
|
+
<Label id="statusLabel" text='Rooibos is running tests' />
|
|
76
|
+
<Label id="failedLabel" text="" translation="[0, 100]" width="1800" wrap="true" maxLines="15"/>
|
|
77
|
+
</children>
|
|
78
|
+
</component>
|
|
79
|
+
`;
|
|
80
80
|
return contents;
|
|
81
81
|
}
|
|
82
82
|
isIgnoredFile(file) {
|
|
@@ -88,7 +88,10 @@ ${scriptImports.join('\n')}
|
|
|
88
88
|
}
|
|
89
89
|
addFile(program, projectPath, contents) {
|
|
90
90
|
try {
|
|
91
|
-
const file = program.setFile({
|
|
91
|
+
const file = program.setFile({
|
|
92
|
+
src: path.resolve(projectPath),
|
|
93
|
+
dest: projectPath
|
|
94
|
+
}, contents);
|
|
92
95
|
this.addedFrameworkFiles.push(file);
|
|
93
96
|
return file;
|
|
94
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileFactory.js","sourceRoot":"","sources":["../../../src/lib/rooibos/FileFactory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"FileFactory.js","sourceRoot":"","sources":["../../../src/lib/rooibos/FileFactory.ts"],"names":[],"mappings":";;;AACA,mDAAsD;AACtD,6BAA6B;AAC7B,yBAAyB;AAEzB,MAAa,WAAW;IAEpB,YACY,OAEP;;QAFO,YAAO,GAAP,OAAO,CAEd;QAcG,uBAAkB,GAAG;YACzB,eAAe;YACf,aAAa;YACb,UAAU;YACV,UAAU;YACV,SAAS;YACT,eAAe;YACf,OAA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CAAC;QACF,OAAO,MAAM,KAAK,SAAS,CAAC;IAChC,CAAC;IAEM,OAAO,CAAC,OAAO,EAAE,WAAmB,EAAE,QAAgB;QACzD,IAAI;YACA,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;gBACzB,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC9B,IAAI,EAAE,WAAW;aACpB,EAAE,QAAQ,CAAC,CAAC;YACb,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,gCAAgC,WAAW,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;SACnF;IACL,CAAC;CAEJ;AA9GD,kCA8GC"}
|
|
@@ -11,7 +11,11 @@ class RawCodeStatement extends brighterscript_1.Statement {
|
|
|
11
11
|
this.range = range;
|
|
12
12
|
}
|
|
13
13
|
transpile(state) {
|
|
14
|
-
|
|
14
|
+
//indent every line with the current transpile indent level (except the first line, because that's pre-indented by bsc)
|
|
15
|
+
let source = this.source.replace(/\r?\n/g, (match, newline) => {
|
|
16
|
+
return state.newline + state.indent();
|
|
17
|
+
});
|
|
18
|
+
return [new source_map_1.SourceNode(this.range.start.line + 1, this.range.start.character, this.sourceFile ? this.sourceFile.pathAbsolute : state.srcPath, source)];
|
|
15
19
|
}
|
|
16
20
|
walk(visitor, options) {
|
|
17
21
|
//nothing to walk
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RawCodeStatement.js","sourceRoot":"","sources":["../../../src/lib/rooibos/RawCodeStatement.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RawCodeStatement.js","sourceRoot":"","sources":["../../../src/lib/rooibos/RawCodeStatement.ts"],"names":[],"mappings":";;;AAKA,mDAGwB;AAExB,2CAAwC;AAIxC,MAAa,gBAAiB,SAAQ,0BAAS;IAC3C,YACW,MAAc,EACd,UAAoB,EACpB,QAAe,sBAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;QAElD,KAAK,EAAE,CAAC;QAJD,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAU;QACpB,UAAK,GAAL,KAAK,CAAsC;IAGtD,CAAC;IAEM,SAAS,CAAC,KAAwB;QACrC,uHAAuH;QACvH,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1D,OAAO,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,uBAAU,CAClB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EACzB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAC1B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAC9D,MAAM,CACT,CAAC,CAAC;IACP,CAAC;IACM,IAAI,CAAC,OAAoB,EAAE,OAAoB;QAClD,iBAAiB;IACrB,CAAC;CACJ;AAzBD,4CAyBC"}
|