rooibos-roku 4.8.0 → 5.0.0
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 +33 -24
- package/dist/lib/framework/CommonUtils.bs +52 -21
- 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
|
|
@@ -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)
|
|
@@ -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
|
|
@@ -1603,6 +1603,15 @@ namespace rooibos
|
|
|
1603
1603
|
return fake
|
|
1604
1604
|
end function
|
|
1605
1605
|
|
|
1606
|
+
function expectLastCallToThrowError(error as dynamic)
|
|
1607
|
+
try
|
|
1608
|
+
mock = m.mocks[m.__mockId.toStr()]
|
|
1609
|
+
mock.toThrow(error)
|
|
1610
|
+
catch error
|
|
1611
|
+
m.log.error("could not add throw to last call", error)
|
|
1612
|
+
end try
|
|
1613
|
+
end function
|
|
1614
|
+
|
|
1606
1615
|
function expectCalled(invocation as dynamic, returnValue = invalid as dynamic, thrownError = invalid as dynamic) as object
|
|
1607
1616
|
'mock function body - the plugin replaces this
|
|
1608
1617
|
return invalid
|
|
@@ -2013,7 +2022,7 @@ namespace rooibos
|
|
|
2013
2022
|
|
|
2014
2023
|
if isUsingMatcher
|
|
2015
2024
|
if not expected.matcher(value)
|
|
2016
|
-
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) + "')")
|
|
2017
2026
|
m.cleanMocks()
|
|
2018
2027
|
end if
|
|
2019
2028
|
else
|
|
@@ -2022,7 +2031,7 @@ namespace rooibos
|
|
|
2022
2031
|
expected = "[INVALID]"
|
|
2023
2032
|
end if
|
|
2024
2033
|
|
|
2025
|
-
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) + "')")
|
|
2026
2035
|
m.cleanMocks()
|
|
2027
2036
|
return
|
|
2028
2037
|
end if
|
|
@@ -303,15 +303,23 @@ 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
308
|
return "Invalid"
|
|
309
309
|
else if Rooibos.Common.isString(input)
|
|
310
|
-
return input
|
|
310
|
+
return """" + input + """"
|
|
311
311
|
else if Rooibos.Common.isInteger(input) or Rooibos.Common.isLongInteger(input) or Rooibos.Common.isBoolean(input)
|
|
312
|
-
|
|
312
|
+
if includeType
|
|
313
|
+
return input.ToStr() + " (" + Rooibos.Common.getSafeType(input) + ")"
|
|
314
|
+
else
|
|
315
|
+
return input.ToStr()
|
|
316
|
+
end if
|
|
313
317
|
else if Rooibos.Common.isFloat(input) or Rooibos.Common.isDouble(input)
|
|
314
|
-
|
|
318
|
+
if includeType
|
|
319
|
+
return Str(input).Trim() + " (" + Rooibos.Common.getSafeType(input) + ")"
|
|
320
|
+
else
|
|
321
|
+
return Str(input).Trim()
|
|
322
|
+
end if
|
|
315
323
|
else if type(input) = "roSGNode"
|
|
316
324
|
return "Node(" + input.subType() + ")"
|
|
317
325
|
else if type(input) = "roAssociativeArray"
|
|
@@ -324,7 +332,7 @@ namespace rooibos.Common
|
|
|
324
332
|
end if
|
|
325
333
|
for each key in input
|
|
326
334
|
if rooibos.Common.canSafelyIterateAAKey(input, key)
|
|
327
|
-
text = text + key + ":" + Rooibos.Common.asString(input[key])
|
|
335
|
+
text = text + key + ":" + Rooibos.Common.asString(input[key], includeType)
|
|
328
336
|
end if
|
|
329
337
|
end for
|
|
330
338
|
text = text + "}"
|
|
@@ -335,7 +343,7 @@ namespace rooibos.Common
|
|
|
335
343
|
maxLen = 500
|
|
336
344
|
for each v in input
|
|
337
345
|
if len(text) < maxLen
|
|
338
|
-
text += join + rooibos.Common.asString(v)
|
|
346
|
+
text += join + rooibos.Common.asString(v, includeType)
|
|
339
347
|
join = ", "
|
|
340
348
|
end if
|
|
341
349
|
end for
|
|
@@ -345,7 +353,7 @@ namespace rooibos.Common
|
|
|
345
353
|
text = text + "]"
|
|
346
354
|
return text
|
|
347
355
|
else if Rooibos.Common.isFunction(input)
|
|
348
|
-
return input.toStr()
|
|
356
|
+
return input.toStr() + "(function)"
|
|
349
357
|
else
|
|
350
358
|
return ""
|
|
351
359
|
end if
|
|
@@ -617,7 +625,7 @@ namespace rooibos.Common
|
|
|
617
625
|
' * @param {Dynamic} Value2 - second item to compare
|
|
618
626
|
' * @returns {boolean} - True if values are equal or False in other case.
|
|
619
627
|
' */
|
|
620
|
-
function eqValues(Value1, Value2) as dynamic
|
|
628
|
+
function eqValues(Value1, Value2, fuzzy = false) as dynamic
|
|
621
629
|
' Workaraund for bug with string boxing, and box everything else
|
|
622
630
|
val1Type = Rooibos.Common.getSafeType(Value1)
|
|
623
631
|
val2Type = Rooibos.Common.getSafeType(Value2)
|
|
@@ -633,17 +641,17 @@ namespace rooibos.Common
|
|
|
633
641
|
Value1 = cdbl(Value1)
|
|
634
642
|
end if
|
|
635
643
|
|
|
636
|
-
if val1Type <> val2Type
|
|
644
|
+
if val1Type <> val2Type and fuzzy <> true
|
|
637
645
|
return false
|
|
638
646
|
else
|
|
639
647
|
valtype = val1Type
|
|
640
648
|
|
|
641
|
-
if
|
|
642
|
-
return Rooibos.Common.eqArray(Value1, Value2)
|
|
649
|
+
if val1Type = "List"
|
|
650
|
+
return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
|
|
643
651
|
else if valtype = "roAssociativeArray"
|
|
644
|
-
return Rooibos.Common.eqAssocArray(Value1, Value2)
|
|
652
|
+
return Rooibos.Common.eqAssocArray(Value1, Value2, fuzzy)
|
|
645
653
|
else if valtype = "roArray"
|
|
646
|
-
return Rooibos.Common.eqArray(Value1, Value2)
|
|
654
|
+
return Rooibos.Common.eqArray(Value1, Value2, fuzzy)
|
|
647
655
|
else if valtype = "roSGNode"
|
|
648
656
|
if val2Type <> "roSGNode"
|
|
649
657
|
return false
|
|
@@ -651,14 +659,37 @@ namespace rooibos.Common
|
|
|
651
659
|
return Value1.isSameNode(Value2)
|
|
652
660
|
end if
|
|
653
661
|
else
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
662
|
+
if fuzzy = true
|
|
663
|
+
return Rooibos.Common.asString(Value1) = Rooibos.Common.asString(Value2)
|
|
664
|
+
else
|
|
665
|
+
'If you crashed on this line, then you're trying to compare
|
|
666
|
+
'2 things which can't be compared - check what value1 and value2
|
|
667
|
+
'are in your debug log
|
|
668
|
+
return Value1 = Value2
|
|
669
|
+
end if
|
|
658
670
|
end if
|
|
659
671
|
end if
|
|
660
672
|
end function
|
|
661
673
|
|
|
674
|
+
function eqTypes(Value1, Value2) as dynamic
|
|
675
|
+
val1Type = Rooibos.Common.getSafeType(Value1)
|
|
676
|
+
val2Type = Rooibos.Common.getSafeType(Value2)
|
|
677
|
+
if val1Type = invalid or val2Type = invalid
|
|
678
|
+
? "ERROR!!!! - undefined value passed"
|
|
679
|
+
return false
|
|
680
|
+
end if
|
|
681
|
+
|
|
682
|
+
'Upcast int to float, if other is float
|
|
683
|
+
if val1Type = "Float" and val2Type = "Integer"
|
|
684
|
+
Value2 = cdbl(Value2)
|
|
685
|
+
else if val2Type = "Float" and val1Type = "Integer"
|
|
686
|
+
Value1 = cdbl(Value1)
|
|
687
|
+
end if
|
|
688
|
+
|
|
689
|
+
return val1Type <> val2Type
|
|
690
|
+
end function
|
|
691
|
+
|
|
692
|
+
|
|
662
693
|
' /**
|
|
663
694
|
' * @memberof module:CommonUtils
|
|
664
695
|
' * @name EqAssocArray
|
|
@@ -669,7 +700,7 @@ namespace rooibos.Common
|
|
|
669
700
|
' * @param {Dynamic} Value2 - second associative array
|
|
670
701
|
' * @returns {boolean} - True if arrays are equal or False in other case.
|
|
671
702
|
' */
|
|
672
|
-
function eqAssocArray(Value1, Value2) as dynamic
|
|
703
|
+
function eqAssocArray(Value1, Value2, fuzzy = false) as dynamic
|
|
673
704
|
l1 = Value1.Count()
|
|
674
705
|
l2 = Value2.Count()
|
|
675
706
|
|
|
@@ -683,7 +714,7 @@ namespace rooibos.Common
|
|
|
683
714
|
if rooibos.common.canSafelyIterateAAKey(Value1, k) and rooibos.common.canSafelyIterateAAKey(Value2, k)
|
|
684
715
|
v1 = Value1[k]
|
|
685
716
|
v2 = Value2[k]
|
|
686
|
-
if not Rooibos.Common.eqValues(v1, v2)
|
|
717
|
+
if not Rooibos.Common.eqValues(v1, v2, fuzzy)
|
|
687
718
|
return false
|
|
688
719
|
end if
|
|
689
720
|
end if
|
|
@@ -713,7 +744,7 @@ namespace rooibos.Common
|
|
|
713
744
|
' * @param {Dynamic} Value2 - second array
|
|
714
745
|
' * @returns {boolean} - True if arrays are equal or False in other case.
|
|
715
746
|
' */
|
|
716
|
-
function eqArray(Value1, Value2) as dynamic
|
|
747
|
+
function eqArray(Value1, Value2, fuzzy = false) as dynamic
|
|
717
748
|
if not (Rooibos.Common.isArray(Value1)) or not Rooibos.Common.isArray(Value2)
|
|
718
749
|
return false
|
|
719
750
|
end if
|
|
@@ -727,7 +758,7 @@ namespace rooibos.Common
|
|
|
727
758
|
for i = 0 to l1 - 1
|
|
728
759
|
v1 = Value1[i]
|
|
729
760
|
v2 = Value2[i]
|
|
730
|
-
if not Rooibos.Common.eqValues(v1, v2)
|
|
761
|
+
if not Rooibos.Common.eqValues(v1, v2, fuzzy)
|
|
731
762
|
return false
|
|
732
763
|
end if
|
|
733
764
|
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,OAAO;YACP,MAAM;YACN,WAAW;YACX,kBAAkB;YAClB,qBAAqB;YACrB,YAAY;YACZ,YAAY;YACZ,OAAO;SACV,CAAC;QAEM,eAAU,GAAG,iBAAiB,CAAC;QAC/B,oBAAe,GAAG,qBAAqB,CAAC;QACzC,wBAAmB,GAAG,EAAE,CAAC;QA/B5B,IAAI,CAAC,OAAO,SAAG,IAAI,CAAC,OAAO,mCAAI,EAAE,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,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"}
|