From 26e1f092b2c4c6050fe3d329af424597b643e35c Mon Sep 17 00:00:00 2001 From: George Cook Date: Tue, 5 Feb 2019 22:33:16 -0500 Subject: [PATCH] bunch of fixes for solo test and solo param filtering, introduces more stub test data to work with (mainly just looking at output right now - needs more asserts) and also better handling of params (deals with bright scripts loose json parser and invalid type, by having direct control of the suite, group and test via asText, as opposed to simply doing asJson and stringily) --- package.json | 6 +- rooibosPreprocessor/package.json | 2 +- rooibosPreprocessor/src/lib/ItGroup.ts | 39 +- .../src/lib/RuntimeConfig.spec.ts | 88 + rooibosPreprocessor/src/lib/RuntimeConfig.ts | 85 +- rooibosPreprocessor/src/lib/TestCase.ts | 22 +- rooibosPreprocessor/src/lib/TestSuite.ts | 27 +- .../src/lib/TestSuiteBuilder.spec.ts | 12 + .../src/lib/TestSuiteBuilder.ts | 27 +- .../source/tests/complexParamsTests.brs | 27 + .../stubProject/source/tests/paramsTest.brs | 4 +- .../stubProject/source/tests/soloGroup.brs | 18 +- .../stubProject/source/tests/soloSuite.brs | 18 +- .../stubProject/source/tests/soloTest.brs | 18 +- .../source/tests/test_LegacyIntegration.brs | 27 - .../src/test/stubProjectNoSolos/Makefile | 41 + .../src/test/stubProjectNoSolos/app.mk | 238 ++ .../components/KeyLogTester.brs | 38 + .../components/KeyLogTester.xml | 22 + .../components/MainScene.brs | 26 + .../components/MainScene.xml | 20 + .../components/NodeExample.brs | 15 + .../components/NodeExample.xml | 33 + .../components/RALETrackerTask.xml | 1843 +++++++++++ .../components/rLogComponents/rLog.brs | 105 + .../components/rLogComponents/rLog.xml | 38 + .../rLogComponents/rLogSGTransport.brs | 64 + .../rLogComponents/rLogSGTransport.xml | 32 + .../rLogComponents/rLogScreenTransport.brs | 15 + .../rLogComponents/rLogScreenTransport.xml | 38 + .../components/tests/NodeExampleTests.xml | 27 + .../components/tests/TestsScene.brs | 3 + .../components/tests/TestsScene.xml | 14 + .../src/test/stubProjectNoSolos/manifest | 4 + .../stubProjectNoSolos/source/TestUtils.brs | 19 + .../stubProjectNoSolos/source/buildinfo.brs | 6 + .../test/stubProjectNoSolos/source/main.brs | 62 + .../source/rLog/rLogMixin.brs | 157 + .../source/rLog/transports/printTransport.brs | 13 + .../rLog/transports/rLogSGTransport.brs | 24 + .../rLog/transports/rLogScreenTransport.brs | 16 + .../stubProjectNoSolos/source/rooibos.cat.brs | 2692 +++++++++++++++++ .../source/tests/NodeExampleTests.brs | 35 + .../source/tests/VideoModuleTests.brs | 85 + .../source/tests/complexParamsTests.brs | 26 + .../source/tests/paramsTest.brs | 16 + .../source/tests/testConfig.json | 9 + .../src/test/stubProjectOnlyItGroup/Makefile | 41 + .../src/test/stubProjectOnlyItGroup/app.mk | 238 ++ .../components/KeyLogTester.brs | 38 + .../components/KeyLogTester.xml | 22 + .../components/MainScene.brs | 26 + .../components/MainScene.xml | 20 + .../components/NodeExample.brs | 15 + .../components/NodeExample.xml | 33 + .../components/RALETrackerTask.xml | 1843 +++++++++++ .../components/rLogComponents/rLog.brs | 105 + .../components/rLogComponents/rLog.xml | 38 + .../rLogComponents/rLogSGTransport.brs | 64 + .../rLogComponents/rLogSGTransport.xml | 32 + .../rLogComponents/rLogScreenTransport.brs | 15 + .../rLogComponents/rLogScreenTransport.xml | 38 + .../components/tests/NodeExampleTests.xml | 27 + .../components/tests/TestsScene.brs | 3 + .../components/tests/TestsScene.xml | 14 + .../src/test/stubProjectOnlyItGroup/manifest | 4 + .../source/TestUtils.brs | 19 + .../source/buildinfo.brs | 6 + .../stubProjectOnlyItGroup/source/main.brs | 62 + .../source/rLog/rLogMixin.brs | 157 + .../source/rLog/transports/printTransport.brs | 13 + .../rLog/transports/rLogSGTransport.brs | 24 + .../rLog/transports/rLogScreenTransport.brs | 16 + .../source/rooibos.cat.brs | 2692 +++++++++++++++++ .../source/tests/NodeExampleTests.brs | 35 + .../source/tests/VideoModuleTests.brs | 85 + .../source/tests/paramsTest.brs | 16 + .../source/tests/soloGroup.brs | 85 + .../source/tests/testConfig.json | 9 + .../src/test/stubProjectOnlySuite/Makefile | 41 + .../src/test/stubProjectOnlySuite/app.mk | 238 ++ .../components/KeyLogTester.brs | 38 + .../components/KeyLogTester.xml | 22 + .../components/MainScene.brs | 26 + .../components/MainScene.xml | 20 + .../components/NodeExample.brs | 15 + .../components/NodeExample.xml | 33 + .../components/RALETrackerTask.xml | 1843 +++++++++++ .../components/rLogComponents/rLog.brs | 105 + .../components/rLogComponents/rLog.xml | 38 + .../rLogComponents/rLogSGTransport.brs | 64 + .../rLogComponents/rLogSGTransport.xml | 32 + .../rLogComponents/rLogScreenTransport.brs | 15 + .../rLogComponents/rLogScreenTransport.xml | 38 + .../components/tests/NodeExampleTests.xml | 27 + .../components/tests/TestsScene.brs | 3 + .../components/tests/TestsScene.xml | 14 + .../src/test/stubProjectOnlySuite/manifest | 4 + .../stubProjectOnlySuite/source/TestUtils.brs | 19 + .../stubProjectOnlySuite/source/buildinfo.brs | 6 + .../test/stubProjectOnlySuite/source/main.brs | 62 + .../source/rLog/rLogMixin.brs | 157 + .../source/rLog/transports/printTransport.brs | 13 + .../rLog/transports/rLogSGTransport.brs | 24 + .../rLog/transports/rLogScreenTransport.brs | 16 + .../source/rooibos.cat.brs | 2692 +++++++++++++++++ .../source/tests/NodeExampleTests.brs | 35 + .../source/tests/VideoModuleTests.brs | 85 + .../source/tests/paramsTest.brs | 16 + .../source/tests/soloSuite.brs | 86 + .../source/tests/testConfig.json | 9 + .../src/test/stubProjectOnlyTests/Makefile | 41 + .../src/test/stubProjectOnlyTests/app.mk | 238 ++ .../components/KeyLogTester.brs | 38 + .../components/KeyLogTester.xml | 22 + .../components/MainScene.brs | 26 + .../components/MainScene.xml | 20 + .../components/NodeExample.brs | 15 + .../components/NodeExample.xml | 33 + .../components/RALETrackerTask.xml | 1843 +++++++++++ .../components/rLogComponents/rLog.brs | 105 + .../components/rLogComponents/rLog.xml | 38 + .../rLogComponents/rLogSGTransport.brs | 64 + .../rLogComponents/rLogSGTransport.xml | 32 + .../rLogComponents/rLogScreenTransport.brs | 15 + .../rLogComponents/rLogScreenTransport.xml | 38 + .../components/tests/NodeExampleTests.xml | 27 + .../components/tests/TestsScene.brs | 3 + .../components/tests/TestsScene.xml | 14 + .../src/test/stubProjectOnlyTests/manifest | 4 + .../stubProjectOnlyTests/source/TestUtils.brs | 19 + .../stubProjectOnlyTests/source/buildinfo.brs | 6 + .../test/stubProjectOnlyTests/source/main.brs | 62 + .../source/rLog/rLogMixin.brs | 157 + .../source/rLog/transports/printTransport.brs | 13 + .../rLog/transports/rLogSGTransport.brs | 24 + .../rLog/transports/rLogScreenTransport.brs | 16 + .../source/rooibos.cat.brs | 2692 +++++++++++++++++ .../source/tests/NodeExampleTests.brs | 35 + .../source/tests/VideoModuleTests.brs | 85 + .../source/tests/paramsTest.brs | 16 + .../source/tests/soloTest.brs | 86 + .../source/tests/testConfig.json | 9 + .../stubProjectOnlyTests_oneFile/Makefile | 41 + .../test/stubProjectOnlyTests_oneFile/app.mk | 238 ++ .../components/KeyLogTester.brs | 38 + .../components/KeyLogTester.xml | 22 + .../components/MainScene.brs | 26 + .../components/MainScene.xml | 20 + .../components/NodeExample.brs | 15 + .../components/NodeExample.xml | 33 + .../components/RALETrackerTask.xml | 1843 +++++++++++ .../components/rLogComponents/rLog.brs | 105 + .../components/rLogComponents/rLog.xml | 38 + .../rLogComponents/rLogSGTransport.brs | 64 + .../rLogComponents/rLogSGTransport.xml | 32 + .../rLogComponents/rLogScreenTransport.brs | 15 + .../rLogComponents/rLogScreenTransport.xml | 38 + .../components/tests/NodeExampleTests.xml | 27 + .../components/tests/TestsScene.brs | 3 + .../components/tests/TestsScene.xml | 14 + .../stubProjectOnlyTests_oneFile/manifest | 4 + .../source/TestUtils.brs | 19 + .../source/buildinfo.brs | 6 + .../source/main.brs | 62 + .../source/rLog/rLogMixin.brs | 157 + .../source/rLog/transports/printTransport.brs | 13 + .../rLog/transports/rLogSGTransport.brs | 24 + .../rLog/transports/rLogScreenTransport.brs | 16 + .../source/rooibos.cat.brs | 2692 +++++++++++++++++ .../source/tests/soloTest.brs | 86 + .../source/tests/testConfig.json | 9 + src/Rooibos_RuntimeConfig.brs | 5 +- 173 files changed, 29323 insertions(+), 85 deletions(-) create mode 100644 rooibosPreprocessor/src/lib/RuntimeConfig.spec.ts create mode 100644 rooibosPreprocessor/src/test/stubProject/source/tests/complexParamsTests.brs delete mode 100644 rooibosPreprocessor/src/test/stubProject/source/tests/test_LegacyIntegration.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/Makefile create mode 100755 rooibosPreprocessor/src/test/stubProjectNoSolos/app.mk create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/MainScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/MainScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/NodeExample.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/NodeExample.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/RALETrackerTask.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLogSGTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLogScreenTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/tests/NodeExampleTests.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/tests/TestsScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/components/tests/TestsScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/manifest create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/TestUtils.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/buildinfo.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/main.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/rLog/rLogMixin.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/rLog/transports/printTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/rLog/transports/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/rLog/transports/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/rooibos.cat.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/tests/NodeExampleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/tests/VideoModuleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/tests/complexParamsTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/tests/paramsTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectNoSolos/source/tests/testConfig.json create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/Makefile create mode 100755 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/app.mk create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/KeyLogTester.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/KeyLogTester.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/MainScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/MainScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/NodeExample.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/NodeExample.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/RALETrackerTask.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLogSGTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLogScreenTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/tests/NodeExampleTests.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/tests/TestsScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/tests/TestsScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/manifest create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/TestUtils.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/buildinfo.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/main.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/rLog/rLogMixin.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/rLog/transports/printTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/rLog/transports/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/rLog/transports/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/rooibos.cat.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/tests/NodeExampleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/tests/VideoModuleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/tests/paramsTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/tests/soloGroup.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyItGroup/source/tests/testConfig.json create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/Makefile create mode 100755 rooibosPreprocessor/src/test/stubProjectOnlySuite/app.mk create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/KeyLogTester.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/KeyLogTester.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/MainScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/MainScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/NodeExample.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/NodeExample.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/RALETrackerTask.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLogSGTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLogScreenTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/tests/NodeExampleTests.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/tests/TestsScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/components/tests/TestsScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/manifest create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/TestUtils.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/buildinfo.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/main.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/rLog/rLogMixin.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/rLog/transports/printTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/rLog/transports/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/rLog/transports/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/rooibos.cat.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/tests/NodeExampleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/tests/VideoModuleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/tests/paramsTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/tests/soloSuite.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlySuite/source/tests/testConfig.json create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/Makefile create mode 100755 rooibosPreprocessor/src/test/stubProjectOnlyTests/app.mk create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/KeyLogTester.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/KeyLogTester.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/MainScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/MainScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/NodeExample.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/NodeExample.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/RALETrackerTask.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLogSGTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLogScreenTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/tests/NodeExampleTests.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/tests/TestsScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/components/tests/TestsScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/manifest create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/TestUtils.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/buildinfo.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/main.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/rLog/rLogMixin.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/rLog/transports/printTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/rLog/transports/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/rLog/transports/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/rooibos.cat.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/tests/NodeExampleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/tests/VideoModuleTests.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/tests/paramsTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/tests/soloTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests/source/tests/testConfig.json create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/Makefile create mode 100755 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/app.mk create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/KeyLogTester.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/KeyLogTester.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/MainScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/MainScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/NodeExample.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/NodeExample.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/RALETrackerTask.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLogSGTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLogScreenTransport.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/tests/NodeExampleTests.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/tests/TestsScene.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/tests/TestsScene.xml create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/manifest create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/TestUtils.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/buildinfo.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/main.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/rLog/rLogMixin.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/rLog/transports/printTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/rLog/transports/rLogSGTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/rLog/transports/rLogScreenTransport.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/rooibos.cat.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/tests/soloTest.brs create mode 100644 rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/source/tests/testConfig.json diff --git a/package.json b/package.json index c5258544..263a995e 100644 --- a/package.json +++ b/package.json @@ -15,14 +15,14 @@ }, "devDependencies": { "del": "^3.0.0", + "docdash": "^0.4.0", "gulp-concat": "^2.6.1", "gulp-copy": "^4.0.1", "gulp-rm-lines": "0.0.9", "gulpclass": "^0.2.0", + "minami": "^1.2.3", "typescript": "^3.3.1", - "vinyl-paths": "^2.1.0", - "docdash": "^0.4.0", - "minami": "^1.2.3" + "vinyl-paths": "^2.1.0" }, "scripts": { "test": "test" diff --git a/rooibosPreprocessor/package.json b/rooibosPreprocessor/package.json index e27eb712..717f11bc 100644 --- a/rooibosPreprocessor/package.json +++ b/rooibosPreprocessor/package.json @@ -1,6 +1,6 @@ { "name": "rooibos-preprocessor", - "version": "1.0.4", + "version": "1.0.5", "description": "preprocessor for roku brightscript and scenegraph projects, using rooibos", "main": "dist/index.ts", "directories": { diff --git a/rooibosPreprocessor/src/lib/ItGroup.ts b/rooibosPreprocessor/src/lib/ItGroup.ts index af56645e..406b018d 100644 --- a/rooibosPreprocessor/src/lib/ItGroup.ts +++ b/rooibosPreprocessor/src/lib/ItGroup.ts @@ -4,6 +4,8 @@ export class ItGroup { constructor(name: string, isSolo: boolean, isIgnore: boolean, filename: string) { this.name = name; this.isSolo = isSolo; + this.hasSoloTests = false; + this.isIncluded = false; this.isIgnored = isIgnore; this.filename = filename; this.testCases = []; @@ -11,6 +13,7 @@ export class ItGroup { this.soloTestCases = []; } + public isIncluded: boolean; public isSolo: boolean; public isIgnored: boolean; public filename: string; @@ -19,7 +22,6 @@ export class ItGroup { public testCases: TestCase[]; public ignoredTestCases: TestCase[]; public soloTestCases: TestCase[]; - public testCaseLookup: boolean; public setupFunctionName: string; public tearDownFunctionName: string; public beforeEachFunctionName: string; @@ -28,11 +30,13 @@ export class ItGroup { public asJson(): object { return { - testCases: this.testCases.map((testCase) => testCase.asJson()), - ignoredTestCases: this.ignoredTestCases.map((testCase) => testCase.asJson()), - soloTestCases: this.soloTestCases.map((testCase) => testCase.asJson()), + testCases: this.testCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asJson()), + ignoredTestCases: this.ignoredTestCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asJson()), + soloTestCases: this.soloTestCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asJson()), filename: this.filename, - testCaseLookup: this.testCaseLookup, setupFunctionName: this.setupFunctionName, tearDownFunctionName: this.tearDownFunctionName, beforeEachFunctionName: this.beforeEachFunctionName, @@ -43,6 +47,31 @@ export class ItGroup { name: this.name }; } + + public asText(): string { + let testCases = this.testCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asText()); + let ignoredTestCases = this.ignoredTestCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asText()); + let soloTestCases = this.soloTestCases.filter( (testCase) => testCase.isIncluded) + .map((testCase) => testCase.asText()); + return ` + { + testCases: [${testCases}] + ignoredTestCases: [${ignoredTestCases}] + soloTestCases: [${soloTestCases}] + filename: "${this.filename}" + setupFunctionName: "${this.setupFunctionName || ''}" + tearDownFunctionName: "${this.tearDownFunctionName || ''}" + beforeEachFunctionName: "${this.beforeEachFunctionName || ''}" + afterEachFunctionName: "${this.afterEachFunctionName || ''}" + isSolo: ${this.isSolo} + isIgnored: ${this.isIgnored} + hasSoloTests: ${this.hasSoloTests} + name: "${this.name || ''}" + }`; + } + public addTestCase(testCase: TestCase) { if (testCase.isSolo) { this.soloTestCases.push(testCase); diff --git a/rooibosPreprocessor/src/lib/RuntimeConfig.spec.ts b/rooibosPreprocessor/src/lib/RuntimeConfig.spec.ts new file mode 100644 index 00000000..976c73d6 --- /dev/null +++ b/rooibosPreprocessor/src/lib/RuntimeConfig.spec.ts @@ -0,0 +1,88 @@ +import * as chai from 'chai'; +import * as fs from 'fs-extra'; +import * as path from 'path'; + +import { expect } from 'chai'; + +import FunctionMap from './FunctionMap'; +import { RuntimeConfig } from './RuntimeConfig'; + +const chaiSubset = require('chai-subset'); + +chai.use(chaiSubset); +let runtimeConfig: RuntimeConfig; +let sourcePathBunchOfFiles = 'src/test/stubProject'; +let sourcePathOneFile = 'src/test/stubProjectOnlyTests_oneFile'; +let sourcePathSoloTests = 'src/test/stubProjectOnlyTests'; +let sourcePathSoloGroup = 'src/test/stubProjectOnlyItGroup'; +let sourcePathSoloSuites = 'src/test/stubProjectOnlySuite'; +let sourcePathNoSolos = 'src/test/stubProjectNoSolos'; +let targetPath = 'build'; + +function clearFiles() { + fs.removeSync(targetPath); +} + +function copyFiles(sourcePath) { + try { + fs.copySync(sourcePath, targetPath); + } catch (err) { + console.error(err); + } +} + +describe('RuntimeConfig tests ', function() { + beforeEach(() => { + let functionMap = new FunctionMap(); + runtimeConfig = new RuntimeConfig(functionMap); + }); + + describe('oneFile', function() { + beforeEach(() => { + clearFiles(); + }); + + it('processes valid test file', () => { + copyFiles(sourcePathOneFile); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + }); + + it('processes bunch of files', () => { + copyFiles(sourcePathBunchOfFiles); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + }); + + it('processes files with solo suite', () => { + copyFiles(sourcePathSoloSuites); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + }); + + it('processes files with solo group', () => { + copyFiles(sourcePathSoloGroup); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + }); + + it('processes files with solo tests', () => { + copyFiles(sourcePathSoloTests); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + }); + + it('processes files with no solo tests', () => { + copyFiles(sourcePathNoSolos); + runtimeConfig.processPath(path.join(targetPath, 'source/tests'), targetPath); + let suites = runtimeConfig.testSuites; + expect(suites).to.not.be.null; + let json = runtimeConfig.asJson(); //TODO test these return values + }); + }); +}); diff --git a/rooibosPreprocessor/src/lib/RuntimeConfig.ts b/rooibosPreprocessor/src/lib/RuntimeConfig.ts index 88709846..64684d8f 100644 --- a/rooibosPreprocessor/src/lib/RuntimeConfig.ts +++ b/rooibosPreprocessor/src/lib/RuntimeConfig.ts @@ -17,17 +17,20 @@ export class RuntimeConfig { this._testSuites = []; this._warnings = []; this._errors = []; + this.ignoredTestNames = []; this._functionMap = functionMap; this._excludeMatcher = new Minimatch(`rooibos.cat.brs`); } + private ignoredCount: number = 0; + private ignoredTestNames: string[]; private readonly _warnings: string[]; private readonly _errors: string[]; private _excludeMatcher: M.IMinimatch; private _testSuites: TestSuite[]; - private _hasSoloSuites: boolean; - private _hasSoloGroups: boolean; - private _hasSoloTests: boolean; + private _hasSoloSuites: boolean = false; + private _hasSoloGroups: boolean = false; + private _hasSoloTests: boolean = false; private _functionMap: FunctionMap; get testSuites(): TestSuite[] { @@ -84,6 +87,9 @@ export class RuntimeConfig { } } }); + + this.updateIncludedFlags(); + this.errors.concat(testSuiteBuilder.errors); this.warnings.concat(testSuiteBuilder.warnings); } @@ -93,13 +99,82 @@ export class RuntimeConfig { function RBSFM_getTestSuitesForProject() return [ `; - this.testSuites.forEach((testSuite) => { - text += `\n${JSON.stringify(testSuite.asJson(), null, 2)},\n`; + if (testSuite.isIncluded) { + text += `\n${testSuite.asText()},\n`; + } }); text += ` ] end function\n`; return text; } + + /** + * Once we know what's ignored/solo/etc, we can ascertain if we're going + * to include it in the final json payload + */ + private updateIncludedFlags() { + this.testSuites.forEach( (testSuite) => { + if (this._hasSoloTests && !testSuite.hasSoloTests) { + testSuite.isIncluded = false; + } else if (this._hasSoloSuites && !testSuite.isSolo) { + testSuite.isIncluded = false; + } else if (testSuite.isIgnored) { + testSuite.isIncluded = false; + this.ignoredTestNames.push('|-' + testSuite.name + ' [WHOLE SUITE]'); + this.ignoredCount++; + } else { + testSuite.isIncluded = true; + } + // console.log('testSuite ' + testSuite.name); + testSuite.itGroups.forEach( (itGroup) => { + // console.log('GROUP ' + itGroup.name); + if (itGroup.isIgnored) { + this.ignoredCount += itGroup.testCases.length; + this.ignoredTestNames.push(' |-' + itGroup.name + ' [WHOLE GROUP]'); + } else { + if (itGroup.ignoredTestCases.length > 0) { + this.ignoredTestNames.push(' |-' + itGroup.name); + this.ignoredCount += itGroup.ignoredTestCases.length; + itGroup.ignoredTestCases.forEach((ignoredTestCase) => { + if (!ignoredTestCase.isParamTest) { + this.ignoredTestNames.push(' | |--' + ignoredTestCase.name); + } else if (ignoredTestCase.paramTestIndex === 0) { + let testCaseName = ignoredTestCase.name; + if (testCaseName.length > 1 && testCaseName.substr(testCaseName.length - 1) === '0') { + testCaseName = testCaseName.substr(0, testCaseName.length - 1); + } + this.ignoredTestNames.push(' | |--' + testCaseName); + } + }); + } + if (this._hasSoloTests && !itGroup.hasSoloTests && !itGroup.isSolo) { + itGroup.isIncluded = false; + } else if (itGroup.testCases.length === 0 && itGroup.soloTestCases.length === 0) { + itGroup.isIncluded = false; + } else { + itGroup.isIncluded = testSuite.isIncluded; + } + itGroup.testCases.forEach( (testCase) => { + // console.log(testCase.name + ' this._hasSoloTests ' + this._hasSoloTests + ' testCase.isSolo ' + testCase.isSolo); + if (this._hasSoloTests && !testCase.isSolo) { + testCase.isIncluded = false; + } else { + testCase.isIncluded = itGroup.isIncluded || testCase.isSolo; + } + }); + itGroup.soloTestCases.forEach( (testCase) => { + // console.log(testCase.name + ' this._hasSoloTests ' + this._hasSoloTests + ' testCase.isSolo ' + testCase.isSolo); + testCase.isIncluded = true; + }); + } + }); + }); + } + + public asJson(): object[] { + return this.testSuites.filter( (testSuite) => testSuite.isIncluded) + .map((testSuite) => testSuite.asJson()); + } } diff --git a/rooibosPreprocessor/src/lib/TestCase.ts b/rooibosPreprocessor/src/lib/TestCase.ts index 865392bd..6322c3a2 100644 --- a/rooibosPreprocessor/src/lib/TestCase.ts +++ b/rooibosPreprocessor/src/lib/TestCase.ts @@ -20,6 +20,7 @@ export class TestCase { } } + public isIncluded: boolean; public isSolo: boolean; public funcName: string; public isIgnored: boolean; @@ -44,13 +45,32 @@ export class TestCase { paramLineNumber: this.paramLineNumber, assertIndex: this.assertIndex, assertLineNumberMap: this.assertLineNumberMap, - rawParams: this.rawParams || [], + rawParams: this.rawParams ? JSON.stringify(this.rawParams).replace(/null/g, 'invalid') : [], paramTestIndex: this.paramTestIndex, expectedNumberOfParams: this.expectedNumberOfParams, isParamsValid: (this.rawParams || []).length === this.expectedNumberOfParams }; } + public asText(): string { + return ` + { + isSolo: ${this.isSolo} + funcName: "${this.funcName || ''}" + isIgnored: ${this.isIgnored} + isParamTest: ${this.isParamTest} + name: "${this.name || ''}" + lineNumber: ${this.lineNumber} + paramLineNumber: ${this.paramLineNumber} + assertIndex: ${this.assertIndex} + assertLineNumberMap: ${JSON.stringify(this.assertLineNumberMap)} + rawParams: ${this.rawParams ? JSON.stringify(this.rawParams).replace(/null/g, 'invalid') : '[]'} + paramTestIndex: ${this.paramTestIndex} + expectedNumberOfParams: ${this.expectedNumberOfParams} + isParamsValid: ${(this.rawParams || []).length === this.expectedNumberOfParams} + }`; + } + public addAssertLine(lineNumber: number) { this.assertLineNumberMap[this.assertIndex.toString().trim()] = lineNumber; this.assertIndex++; diff --git a/rooibosPreprocessor/src/lib/TestSuite.ts b/rooibosPreprocessor/src/lib/TestSuite.ts index cc83dd23..c1a16745 100644 --- a/rooibosPreprocessor/src/lib/TestSuite.ts +++ b/rooibosPreprocessor/src/lib/TestSuite.ts @@ -25,6 +25,7 @@ export class TestSuite { public isSolo: boolean; public isIgnored: boolean; public isValid: boolean; + public isIncluded: boolean; public itGroups: ItGroup[]; public hasFailures: boolean; @@ -49,7 +50,8 @@ export class TestSuite { hasSoloGroups: this.hasSoloGroups, isSolo: this.isSolo, isIgnored: this.isIgnored, - itGroups: this.itGroups.map((itGroup) => itGroup.asJson()), + itGroups: this.itGroups.filter( (itGroup) => itGroup.isIncluded) + .map((itGroup) => itGroup.asJson()), setupFunctionName: this.setupFunctionName, tearDownFunctionName: this.tearDownFunctionName, isNodeTest: this.isNodeTest, @@ -58,4 +60,27 @@ export class TestSuite { afterEachFunctionName: this.afterEachFunctionName, }; } + + public asText(): string { + let itGroups = this.itGroups.filter( (itGroup) => itGroup.isIncluded) + .map((itGroup) => itGroup.asText()); + return `{ + name: "${this.name}" + filePath: "${this.filePath}" + valid: ${this.isValid} + hasFailures: ${this.hasFailures} + hasSoloTests: ${this.hasSoloTests} + hasIgnoredTests: ${this.hasIgnoredTests} + hasSoloGroups: ${this.hasSoloGroups} + isSolo: ${this.isSolo} + isIgnored: ${this.isIgnored} + itGroups: [${itGroups}] + setupFunctionName: "${this.setupFunctionName || ''}" + tearDownFunctionName: "${this.tearDownFunctionName || ''}" + isNodeTest: ${this.isNodeTest} + nodeTestFileName: "${this.nodeTestFileName || ''}" + beforeEachFunctionName: "${this.beforeEachFunctionName || ''}" + afterEachFunctionName: "${this.afterEachFunctionName || ''}" + }`; + } } diff --git a/rooibosPreprocessor/src/lib/TestSuiteBuilder.spec.ts b/rooibosPreprocessor/src/lib/TestSuiteBuilder.spec.ts index 1243e6b8..e50906f6 100644 --- a/rooibosPreprocessor/src/lib/TestSuiteBuilder.spec.ts +++ b/rooibosPreprocessor/src/lib/TestSuiteBuilder.spec.ts @@ -132,5 +132,17 @@ describe('TestSuiteBuilder tests ', function() { expect(testSuite.itGroups[0].testCases[1].rawParams.length).to.equal(2); }); + it('complex params', () => { + let fileDescriptor = new FileDescriptor(`build/source/tests`, `complexParamsTests.brs`, `.brs`); + let testSuite = builder.processFile(fileDescriptor); + expect(testSuite).to.not.be.null; + expect(testSuite.isValid).to.be.true; + expect(testSuite.itGroups[0].testCases[0].expectedNumberOfParams).to.equal(3); + expect(testSuite.itGroups[0].testCases[0].rawParams.length).to.equal(3); + + expect(testSuite.itGroups[0].testCases[1].expectedNumberOfParams).to.equal(3); + expect(testSuite.itGroups[0].testCases[1].rawParams.length).to.equal(3); + }); + }); }); diff --git a/rooibosPreprocessor/src/lib/TestSuiteBuilder.ts b/rooibosPreprocessor/src/lib/TestSuiteBuilder.ts index 9279ebf3..855ce67c 100644 --- a/rooibosPreprocessor/src/lib/TestSuiteBuilder.ts +++ b/rooibosPreprocessor/src/lib/TestSuiteBuilder.ts @@ -5,7 +5,6 @@ import { ItGroup } from './ItGroup'; import { Tag } from './Tag'; import { TestCase } from './TestCase'; import { TestSuite } from './TestSuite'; -import { expect } from 'chai'; const debug = Debug('RooibosProcessor'); @@ -18,8 +17,10 @@ export class TestSuiteBuilder { this._maxLinesWithoutSuiteDirective = maxLinesWithoutSuiteDirective; this.functionNameRegex = new RegExp('^\\s*(function|sub)\\s*([0-9a-z_]*)s*\\(', 'i'); this.functionSignatureRegex = new RegExp('^\\s*(function|sub)\\s*[0-9a-z_]*s*\\((.*)\\)', 'i'); - this.assertInvocationRegex = new RegExp('^\s*(testSuite.fail|testSuite.Fail|testSuite.assert|testSuite.Assert)(.*)\\(', 'i'); + this.assertInvocationRegex = new RegExp('^\\s*(m\\.fail|m\\.assert)(.*)\\(', 'i'); + this.paramsInvalidToNullRegex = /(,|\:|\[)(\s*)(invalid)/g; this.functionEndRegex = new RegExp('^\s*(end sub|end function)', 'i'); + this.badJsonRegex = /(['"])?([a-z0-9A-Z_]+)(['"])?:/g; this._warnings = []; this._errors = []; } @@ -33,7 +34,9 @@ export class TestSuiteBuilder { private functionEndRegex: RegExp; private functionNameRegex: RegExp; private functionSignatureRegex: RegExp; + private paramsInvalidToNullRegex: RegExp; private assertInvocationRegex: RegExp; + private badJsonRegex: RegExp; private hasCurrentTestCase: boolean; private testCaseParams: object[]; @@ -78,7 +81,6 @@ export class TestSuiteBuilder { let nextName = ''; let name = fileDescriptor.normalizedFileName; let filename = fileDescriptor.normalizedFileName; - let lineNumber = 0; this.reset(); let currentLocation = ''; let lines = code.split(/\r?\n/); @@ -88,9 +90,10 @@ export class TestSuiteBuilder { this.currentGroup = null; this.reset(); - for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) { + for (let lineNumber = 1; lineNumber <= lines.length; lineNumber++) { currentLocation = filePath + ':' + lineNumber.toString(); - let line = lines[lineNumber]; + let line = lines[lineNumber - 1]; + // console.log(line); if (lineNumber > this._maxLinesWithoutSuiteDirective && !isTestSuite) { debug('IGNORING FILE WITH NO TESTSUITE DIRECTIVE : ' + currentLocation); this.warnings.push('Ignoring file with no test suite directive' + fileDescriptor.fullPath); @@ -174,6 +177,7 @@ export class TestSuiteBuilder { this.warnings.push(`Tag.TEST MARKED FOR Tag.IGNORE AND Tag.SOLO ${currentLocation}`); } else { isNextTokenSolo = true; + // console.log('isNextTokenSolo is true!! ' + line + ' ' + currentLocation); } continue; } else if (this.isTag(line, Tag.IGNORE) && !this.isTag(line, Tag.TEST_IGNORE_PARAMS)) { @@ -258,7 +262,7 @@ export class TestSuiteBuilder { this.warnings.push(`FOUND ` + Tag.TEST + ` PARAM WITHOUT @Test declaration ` + currentLocation); } else { isNextTokenTestCaseParam = true; - this.addParamsForLine(line, lineNumber, this.testCaseParamLines, this.testCaseParams, currentLocation); + this.addParamsForLine(line, Tag.TEST_PARAMS, lineNumber, this.testCaseParamLines, this.testCaseParams, currentLocation); } continue; } else if (this.isTag(line, Tag.TEST_SOLO_PARAMS)) { @@ -268,7 +272,7 @@ export class TestSuiteBuilder { } else { isNextTokenSolo = true; isNextTokenTestCaseParam = true; - this.addParamsForLine(line, lineNumber, this.testCaseOnlyParamLines, this.testCaseOnlyParams, currentLocation); + this.addParamsForLine(line, Tag.TEST_SOLO_PARAMS, lineNumber, this.testCaseOnlyParamLines, this.testCaseOnlyParams, currentLocation); } continue; } @@ -315,6 +319,7 @@ export class TestSuiteBuilder { this.currentTestCases.forEach((aTestCase) => { this.currentGroup.addTestCase(aTestCase); if (aTestCase.isSolo) { + // console.log('>>> ' + aTestCase.name + ' IS SOLO!'); testSuite.hasSoloTests = true; } }); @@ -430,9 +435,9 @@ export class TestSuiteBuilder { } public reset() { - this.testCaseOnlyParams = []; this.testCaseParams = []; this.testCaseParamLines = []; + this.testCaseOnlyParams = []; this.testCaseOnlyParamLines = []; this.currentTestCases = []; @@ -440,10 +445,10 @@ export class TestSuiteBuilder { this.hasCurrentTestCase = false; } - public addParamsForLine(line: string, lineNumber: number, targetParamLinesArray: number[], targetParamsArray: object[], currentLocation: string) { - let rawParams = this.getTagText(line, Tag.TEST_PARAMS); + public addParamsForLine(line: string, tag: Tag, lineNumber: number, targetParamLinesArray: number[], targetParamsArray: object[], currentLocation: string) { + let rawParams = this.getTagText(line, tag); try { - let jsonParams = JSON.parse(rawParams); + let jsonParams = JSON.parse(rawParams.replace(this.badJsonRegex, '"$2": ').replace(this.paramsInvalidToNullRegex, '$1$2null')); targetParamsArray.push(jsonParams); targetParamLinesArray.push(lineNumber); } catch (e) { diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/complexParamsTests.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/complexParamsTests.brs new file mode 100644 index 00000000..3bcc0879 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProject/source/tests/complexParamsTests.brs @@ -0,0 +1,27 @@ +'@TestSuite [CPT] ComplexParamsTests + +'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +'@It complex params +'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +'@Only +'@Test basic test +'@Params[invalid, invalid, invalid] +'@Params[{}, invalid, invalid] +'@Params[{}, invalid, invalid] +'@Params[{isClip:true}, invalid, "clip"] +'@Params[{isClip:true}, {}, "clip"] +'@Params[{isClip:true}, {type:"EpisodeContentItem"}, "clip"] +'@Params[{isClip:false}, {type:"Episode"}, "episode"] +'@Params[{isClip:false}, {type:"EpisodeContentItem"}, "episode"] +'@Params[{isClip:false}, {type:"EpisodeSearchHit"}, "episode"] +'@Params[{isClip:false}, {type:"Show"}, "show"] +'@Params[{isClip:false}, {type:"ShowContentItem"}, "show"] +'@Params[{isClip:false}, {type:"ShowSearchHit"}, "show"] +function CPT_getVideosRealExample_basic(videoType, returnedJson, typeName) as void + getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true) + + videos = m.module.getVideosRealExample(videoType) + + m.AssertArrayContainsSubset(videos, returnedJson) +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/paramsTest.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/paramsTest.brs index a534076d..c5592d2d 100644 --- a/rooibosPreprocessor/src/test/stubProject/source/tests/paramsTest.brs +++ b/rooibosPreprocessor/src/test/stubProject/source/tests/paramsTest.brs @@ -1,4 +1,4 @@ -'@TestSuite [VMT] VideoModuleTests +'@TestSuite [PT] ParamsTests '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '@It simple params @@ -7,7 +7,7 @@ '@Test basic test '@Params["mp4", ["a", "b", "c"]] '@Params["mp3", ["a", "b", "c", "d", "e"]] -function VMT__getVideosRealExample_basic(videoType, returnedJson) as void +function PT__getVideosRealExample_basic(videoType, returnedJson) as void getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true) videos = m.module.getVideosRealExample(videoType) diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/soloGroup.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/soloGroup.brs index 76546ce1..5d96aed8 100644 --- a/rooibosPreprocessor/src/test/stubProject/source/tests/soloGroup.brs +++ b/rooibosPreprocessor/src/test/stubProject/source/tests/soloGroup.brs @@ -1,18 +1,18 @@ -'@TestSuite [VMT] VideoModuleTests +'@TestSuite [SG] SoloGroup '@Setup -function VMT_Setup() +function SG_Setup() ? "setp" end function '@TearDown -function VMT_TearDown() +function SG_TearDown() ? "tearDown" end function '@BeforeEach -function VMT_BeforeEach() +function SG_BeforeEach() m.constants = {} m.httpService = {} @@ -24,7 +24,7 @@ end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '@Test basic constructor values -function VMT__constructor_basic() as void +function SG__constructor_basic() as void m.AssertEqual(m.module.constants_, m.constants) m.AssertEqual(m.module.httpService_, m.httpService) end function @@ -36,12 +36,12 @@ end function '@BeforeEach -function VMT_GetVideosBeforeEach() +function SG_GetVideosBeforeEach() ? "gtVideosBeforeEach" end function '@AfterEach -function VMT_GetvideosAfterEach() +function SG_GetvideosAfterEach() ? "getvideosAfterEach" end function @@ -50,7 +50,7 @@ end function '@Params[3, "mp4", ["video_0", "video_1", "video_2"]] '@Params[2, "mpg", ["video_0", "video_1"]] '@Params[1, "vp8", ["video_0"]] -function VMT__getVideos_basic(expectedCount, videoType, videoIds) as void +function SG__getVideos_basic(expectedCount, videoType, videoIds) as void videos = m.module.getVideos(videoType) m.AssertArrayCount(videos, expectedCount) @@ -71,7 +71,7 @@ end function '@Test basic test '@Params["mp4", ["a", "b", "c"]] '@Params["mp3", ["a", "b", "c", "d", "e"]] -function VMT__getVideosRealExample_basic(videoType, returnedJson) as void +function SG__getVideosRealExample_basic(videoType, returnedJson) as void getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true) videos = m.module.getVideosRealExample(videoType) diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/soloSuite.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/soloSuite.brs index eea7fe17..ff05b5d2 100644 --- a/rooibosPreprocessor/src/test/stubProject/source/tests/soloSuite.brs +++ b/rooibosPreprocessor/src/test/stubProject/source/tests/soloSuite.brs @@ -1,19 +1,19 @@ '@Only -'@TestSuite [VMT] VideoModuleTests +'@TestSuite [SS] SoloSuite '@Setup -function VMT_Setup() +function SS_Setup() ? "setp" end function '@TearDown -function VMT_TearDown() +function SS_TearDown() ? "tearDown" end function '@BeforeEach -function VMT_BeforeEach() +function SS_BeforeEach() m.constants = {} m.httpService = {} @@ -25,7 +25,7 @@ end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '@Test basic constructor values -function VMT__constructor_basic() as void +function SS__constructor_basic() as void m.AssertEqual(m.module.constants_, m.constants) m.AssertEqual(m.module.httpService_, m.httpService) end function @@ -37,12 +37,12 @@ end function '@BeforeEach -function VMT_GetVideosBeforeEach() +function SS_GetVideosBeforeEach() ? "gtVideosBeforeEach" end function '@AfterEach -function VMT_GetvideosAfterEach() +function SS_GetvideosAfterEach() ? "getvideosAfterEach" end function @@ -51,7 +51,7 @@ end function '@Params[3, "mp4", ["video_0", "video_1", "video_2"]] '@Params[2, "mpg", ["video_0", "video_1"]] '@Params[1, "vp8", ["video_0"]] -function VMT__getVideos_basic(expectedCount, videoType, videoIds) as void +function SS__getVideos_basic(expectedCount, videoType, videoIds) as void videos = m.module.getVideos(videoType) m.AssertArrayCount(videos, expectedCount) @@ -72,7 +72,7 @@ end function '@Test basic test '@Params["mp4", ["a", "b", "c"]] '@Params["mp3", ["a", "b", "c", "d", "e"]] -function VMT__getVideosRealExample_basic(videoType, returnedJson) as void +function SS__getVideosRealExample_basic(videoType, returnedJson) as void getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true) videos = m.module.getVideosRealExample(videoType) diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/soloTest.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/soloTest.brs index 72d33a34..9f3492b5 100644 --- a/rooibosPreprocessor/src/test/stubProject/source/tests/soloTest.brs +++ b/rooibosPreprocessor/src/test/stubProject/source/tests/soloTest.brs @@ -1,18 +1,18 @@ -'@TestSuite [VMT] VideoModuleTests +'@TestSuite [STests] SoloTests '@Setup -function VMT_Setup() +function ST_Setup() ? "setp" end function '@TearDown -function VMT_TearDown() +function ST_TearDown() ? "tearDown" end function '@BeforeEach -function VMT_BeforeEach() +function ST_BeforeEach() m.constants = {} m.httpService = {} @@ -24,7 +24,7 @@ end function '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '@Test basic constructor values -function VMT__constructor_basic() as void +function ST__constructor_basic() as void m.AssertEqual(m.module.constants_, m.constants) m.AssertEqual(m.module.httpService_, m.httpService) end function @@ -36,12 +36,12 @@ end function '@BeforeEach -function VMT_GetVideosBeforeEach() +function ST_GetVideosBeforeEach() ? "gtVideosBeforeEach" end function '@AfterEach -function VMT_GetvideosAfterEach() +function ST_GetvideosAfterEach() ? "getvideosAfterEach" end function @@ -50,7 +50,7 @@ end function '@Params[3, "mp4", ["video_0", "video_1", "video_2"]] '@Params[2, "mpg", ["video_0", "video_1"]] '@Params[1, "vp8", ["video_0"]] -function VMT__getVideos_basic(expectedCount, videoType, videoIds) as void +function ST__getVideos_basic(expectedCount, videoType, videoIds) as void videos = m.module.getVideos(videoType) m.AssertArrayCount(videos, expectedCount) @@ -72,7 +72,7 @@ end function '@Test basic test '@Params["mp4", ["a", "b", "c"]] '@Params["mp3", ["a", "b", "c", "d", "e"]] -function VMT__getVideosRealExample_basic(videoType, returnedJson) as void +function ST__getVideosRealExample_basic(videoType, returnedJson) as void getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true) videos = m.module.getVideosRealExample(videoType) diff --git a/rooibosPreprocessor/src/test/stubProject/source/tests/test_LegacyIntegration.brs b/rooibosPreprocessor/src/test/stubProject/source/tests/test_LegacyIntegration.brs deleted file mode 100644 index 556560e4..00000000 --- a/rooibosPreprocessor/src/test/stubProject/source/tests/test_LegacyIntegration.brs +++ /dev/null @@ -1,27 +0,0 @@ -'@Ignore - not supported -Function testSuite_LegacyIntegration() - this = BaseTestSuite() - - this.Name = "LegacyIntegrationTestSuite" - - this.SetUp = LegacyIntegrationTestSuite_SetUp - - this.addTest("simpleResult", testCase_LegacyIntegration_simpleResult) - this.addTest("multipleAsserts", testCase_LegacyIntegration_multipleAsserts) - return this -End Function - - -Function LegacyIntegrationTestSuite_SetUp() - m.testData = {"key": "value"} -End Function - -Function testCase_LegacyIntegration_simpleResult() - return m.AssertNotInvalid(m.testData) -End Function - - -Function testCase_LegacyIntegration_multipleAsserts() - result = m.AssertNotInvalid(m.testData) - result += m.AssertEqual(m.testdata.key, "value") -End Function diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/Makefile b/rooibosPreprocessor/src/test/stubProjectNoSolos/Makefile new file mode 100644 index 00000000..7cc0118a --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/Makefile @@ -0,0 +1,41 @@ +######################################################################### +# Makefile Usage: +# > make test ' run all tests +# > make testFailures ' run all tests and show only failures +# +# 1) Make sure that you have the curl command line executable in your path +# 2) Set the variable ROKU_DEV_TARGET in your environment to the IP +# address of your Roku box. (e.g. export ROKU_DEV_TARGET=192.168.1.1. +# Set in your this variable in your shell startup (e.g. .bashrc) +# 3) and set up the DEVPASSWORD environment variable, too +########################################################################## + +APPNAME = rLogSampleOverview +VERSION = 0.1.0 +ROKU_TEST_ID = 1 +ROKU_TEST_WAIT_DURATION = 5 + +ZIP_EXCLUDE= -x xml/* -x artwork/* -x \*.pkg -x storeassets\* -x keys\* -x \*/.\* -x *.git* -x *.DS* -x *.pkg* -x dist/**\* -x out/**\* -x node_modules/**\* -x node_modules + +include app.mk + +test: remove install + echo "Running tests" + curl -d '' "http://${ROKU_DEV_TARGET}:8060/keypress/home" + curl -d '' "http://${ROKU_DEV_TARGET}:8060/launch/dev?RunTests=true&logLevel=4" + sleep 10 | telnet ${ROKU_DEV_TARGET} 8085 + +testFailures: remove install + echo "Running tests - only showing failures" + curl -d '' "http://${ROKU_DEV_TARGET}:8060/keypress/home" + curl -d '' "http://${ROKU_DEV_TARGET}:8060/launch/dev?RunTests=true&showOnlyFailures=true&logLevel=4" + sleep 10 | telnet ${ROKU_DEV_TARGET} 8085 + +continuousIntegration: remove install + curl -d '' "http://${ROKU_DEV_TARGET}:8060/keypress/home" + curl -d '' "http://${ROKU_DEV_TARGET}:8060/launch/dev?RunTests=true&testId=${ROKU_TEST_ID}" + + -sleep ${ROKU_TEST_WAIT_DURATION} | telnet ${ROKU_DEV_TARGET} 8085 | tee dist/test.log + + if tail -2 dist/test.log | head | grep -q "RESULT: Success"; then echo "SUCCESS"; else exit -1; fi + diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/app.mk b/rooibosPreprocessor/src/test/stubProjectNoSolos/app.mk new file mode 100755 index 00000000..7f1bfa47 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/app.mk @@ -0,0 +1,238 @@ +######################################################################### +# common include file for application Makefiles +# +# Makefile Common Usage: +# > make +# > make install +# > make remove +# +# Makefile Less Common Usage: +# > make art-opt +# > make pkg +# > make install_native +# > make remove_native +# > make tr +# +# By default, ZIP_EXCLUDE will exclude -x \*.pkg -x storeassets\* -x keys\* -x .\* +# If you define ZIP_EXCLUDE in your Makefile, it will override the default setting. +# +# To exclude different files from being added to the zipfile during packaging +# include a line like this:ZIP_EXCLUDE= -x keys\* +# that will exclude any file who's name begins with 'keys' +# to exclude using more than one pattern use additional '-x ' arguments +# ZIP_EXCLUDE= -x \*.pkg -x storeassets\* +# +# Important Notes: +# To use the "install" and "remove" targets to install your +# application directly from the shell, you must do the following: +# +# 1) Make sure that you have the curl command line executable in your path +# 2) Set the variable ROKU_DEV_TARGET in your environment to the IP +# address of your Roku box. (e.g. export ROKU_DEV_TARGET=192.168.1.1. +# Set in your this variable in your shell startup (e.g. .bashrc) +########################################################################## +DISTREL = ../dist +COMMONREL ?= ../common +SOURCEREL = . + +ZIPREL = $(DISTREL)/apps +PKGREL = $(DISTREL)/packages + +APPSOURCEDIR = source +IMPORTFILES = $(foreach f,$(IMPORTS),$(COMMONREL)/$f.brs) +IMPORTCLEANUP = $(foreach f,$(IMPORTS),$(APPSOURCEDIR)/$f.brs) + +NATIVEDEVREL = $(DISTREL)/rootfs/Linux86_dev.OBJ/root/nvram/incoming +NATIVEDEVPKG = $(NATIVEDEVREL)/dev.zip +NATIVETICKLER = $(DISTREL)/application/Linux86_dev.OBJ/root/bin/plethora tickle-plugin-installer + +APPGENKEY = ./GENKEY +APPDEVID = $(shell grep DevID $(APPGENKEY) | sed "s/DevID: //") +GITCOMMIT = $(shell git rev-parse --short HEAD) +BUILDDATE = $(shell date -u | awk '{ print $$2,$$3,$$6,$$4 }') + +ifdef DEVPASSWORD + USERPASS = rokudev:$(DEVPASSWORD) +else + USERPASS = rokudev +endif + +ifndef ZIP_EXCLUDE + ZIP_EXCLUDE= -x \*.pkg -x storeassets\* -x keys\* -x \*/.\* +endif + +HTTPSTATUS = $(shell curl --silent --write-out "\n%{http_code}\n" $(ROKU_DEV_TARGET)) + +ifeq "$(HTTPSTATUS)" " 401" + CURLCMD = curl -S --connect-timeout 2 --max-time 30 --retry 5 +else + CURLCMD = curl -S --connect-timeout 2 --max-time 30 --retry 5 --user $(USERPASS) --digest +endif + +.PHONY: all $(APPNAME) verify-keys home + +home: + @echo "Forcing roku to main menu screen $(ROKU_DEV_TARGET)..." + curl -s -S -d '' http://$(ROKU_DEV_TARGET):8060/keypress/home + sleep 2 + +$(APPNAME): manifest + @echo "*** Creating $(APPNAME).zip ***" + + @echo " >> removing old application zip $(ZIPREL)/$(APPNAME).zip" + @if [ -e "$(ZIPREL)/$(APPNAME).zip" ]; \ + then \ + rm $(ZIPREL)/$(APPNAME).zip; \ + fi + + @echo " >> creating destination directory $(ZIPREL)" + @if [ ! -d $(ZIPREL) ]; \ + then \ + mkdir -p $(ZIPREL); \ + fi + + @echo " >> setting directory permissions for $(ZIPREL)" + @if [ ! -w $(ZIPREL) ]; \ + then \ + chmod 755 $(ZIPREL); \ + fi + + @echo " >> copying imports" + @if [ "$(IMPORTFILES)" ]; \ + then \ + mkdir $(APPSOURCEDIR)/common; \ + cp -f -p -v $(IMPORTFILES) $(APPSOURCEDIR)/common/; \ + fi \ + + @echo " >> generating build info file" + @if [ -e "$(APPSOURCEDIR)/buildinfo.brs" ]; \ + then \ + rm $(APPSOURCEDIR)/buildinfo.brs; \ + fi + echo "Function BuildDate()" >> $(APPSOURCEDIR)/buildinfo.brs + echo " return \"${BUILDDATE}\"" >> $(APPSOURCEDIR)/buildinfo.brs + echo "End Function" >> $(APPSOURCEDIR)/buildinfo.brs + echo "Function BuildCommit()" >> $(APPSOURCEDIR)/buildinfo.brs + echo " return \"${GITCOMMIT}\"" >> $(APPSOURCEDIR)/buildinfo.brs + echo "End Function" >> $(APPSOURCEDIR)/buildinfo.brs + +# zip .png files without compression +# do not zip up Makefiles, or any files ending with '~' + @echo " >> creating application zip $(ZIPREL)/$(APPNAME).zip" + @if [ -d $(SOURCEREL) ]; \ + then \ + (zip -0 -r "$(ZIPREL)/$(APPNAME).zip" . -i \*.png $(ZIP_EXCLUDE)); \ + (zip -9 -r "$(ZIPREL)/$(APPNAME).zip" . -x \*~ -x \*.png -x Makefile $(ZIP_EXCLUDE)); \ + else \ + echo "Source for $(APPNAME) not found at $(SOURCEREL)"; \ + fi + + @if [ "$(IMPORTCLEANUP)" ]; \ + then \ + echo " >> deleting imports";\ + rm -r -f $(APPSOURCEDIR)/common; \ + fi \ + + @echo "*** packaging $(APPNAME) complete ***" + + +install: $(APPNAME) home + @echo "Installing $(APPNAME) to host $(ROKU_DEV_TARGET)" + @$(CURLCMD) --user $(USERPASS) --digest -F "mysubmit=Install" -F "archive=@$(ZIPREL)/$(APPNAME).zip" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "//" | sed "s[[[" + +# Make certain that the Roku is packaging with the correct key/DevID +verify-keys: $(APPGENKEY) + @echo "Verifying developer key is $(APPDEVID)" + @if [ "$(HTTPSTATUS)" == " 401" ]; \ + then \ + ROKU_DEV_ID=`$(CURLCMD) --user $(USERPASS) --digest http://$(ROKU_DEV_TARGET)/plugin_package | grep $(APPDEVID)`; \ + if [ "$$ROKU_DEV_IDx" == "x" ]; then echo "ROKU_DEV_ID doesn't match $(APPDEVID)"; exit 1; fi \ + else \ + ROKU_DEV_ID=`$(CURLCMD) http://$(ROKU_DEV_TARGET)/plugin_package | grep $(APPDEVID)`; \ + if [ "$$ROKU_DEV_IDx" == "x" ]; then echo "ROKU_DEV_ID doesn't match $(APPDEVID)"; exit 1; fi \ + fi + +pkg: install verify-keys + @echo "*** Creating Package ***" + + @echo " >> creating destination directory $(PKGREL)" + @if [ ! -d $(PKGREL) ]; \ + then \ + mkdir -p $(PKGREL); \ + fi + + @echo " >> setting directory permissions for $(PKGREL)" + @if [ ! -w $(PKGREL) ]; \ + then \ + chmod 755 $(PKGREL); \ + fi + + @echo "Packaging $(APPSRC)/$(APPNAME) on host $(ROKU_DEV_TARGET)" + @if [ "$(HTTPSTATUS)" == " 401" ]; \ + then \ + read -p "Password: " REPLY ; echo $$REPLY | xargs -I{} $(CURLCMD) --user $(USERPASS) --digest -Fmysubmit=Package -Fapp_name=$(APPNAME)/$(VERSION) -Fpasswd={} -Fpkg_time=`expr \`date +%s\` \* 1000` "http://$(ROKU_DEV_TARGET)/plugin_package" | grep '^//" | sed "s[[[" ; \ + else \ + curl -s -S -F "mysubmit=Delete" -F "archive=" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "//" | sed "s[[[" ; \ + fi + +install_native: $(APPNAME) + @echo "Installing $(APPNAME) to native." + @mkdir -p $(NATIVEDEVREL) + @cp $(ZIPREL)/$(APPNAME).zip $(NATIVEDEVPKG) + @$(NATIVETICKLER) + +remove_native: + @echo "Removing $(APPNAME) from native." + @rm $(NATIVEDEVPKG) + @$(NATIVETICKLER) + +APPS_JPG_ART=`\find . -name "*.jpg"` + +art-jpg-opt: + p4 edit $(APPS_JPG_ART) + for i in $(APPS_JPG_ART); \ + do \ + TMPJ=`mktemp` || return 1; \ + echo "optimizing $$i"; \ + (jpegtran -copy none -optimize -outfile $$TMPJ $$i && mv -f $$TMPJ $$i &); \ + done + wait + p4 revert -a $(APPS_JPG_ART) + +APPS_PNG_ART=`\find . -name "*.png"` + +art-png-opt: + p4 edit $(APPS_PNG_ART) + for i in $(APPS_PNG_ART); \ + do \ + (optipng -o7 $$i &); \ + done + wait + p4 revert -a $(APPS_PNG_ART) + +art-opt: art-png-opt art-jpg-opt + +tr: + p4 edit locale/.../translations.xml + ../../rdk/rokudev/utilities/linux/bin/maketr + rm locale/en_US/translations.xml + p4 revert -a locale/.../translations.xml + +screenshot: + SCREENSHOT_TIME=`date "+%s"`; \ + curl -m 1 -o screenshot.jpg --user $(USERPASS) --digest "http://$(ROKU_DEV_TARGET)/pkgs/dev.jpg?time=$$SCREENSHOT_TIME" -H 'Accept: image/png,image/*;q=0.8,*/*;q=0.5' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' + + + + diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.brs b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.brs new file mode 100644 index 00000000..7689b679 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.brs @@ -0,0 +1,38 @@ +function initialize(args) as void + registerLogger(m.top.id) + doPretendMethodImpl() +end function + +function OnKeyEvent(key as String, press as Boolean) as Boolean + if press + if key = "left" + logDebug("Keypress {0}", key) + else if key = "right" + logVerbose("Keypress {0}", key) + else if key = "up" + logInfo("Keypress {0}", key) + else if key = "down" + logWarn("Keypress {0}", key) + else if key = "OK" + doPretendMethodImpl() + end if + end if + return false +end function + +function doPretendMethodImpl() + logMethod("onGetVideos") + logInfo("retriving videos for category id", 23) + logVerbose("loading") + logDebug("using https url is", "http://someurl") + logDebug("using GET request") + logInfo("got result json ", {videos:[{id:1, title:"video stuff"}]}) + logWarn("found malformed json for id ", 23) + logWarn("found malformed json for id ", 24) + logWarn("found malformed json for id ", 26) + logInfo("loaded videos") + + logMethod("UpdateView") + logError("no focus is set, setting to ", m.top) +end function + diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.xml b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.xml new file mode 100644 index 00000000..fa4f2c38 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/KeyLogTester.xml @@ -0,0 +1,22 @@ + + + + + + + + + + \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.brs b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.brs new file mode 100644 index 00000000..6b3fa324 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.brs @@ -0,0 +1,105 @@ +function Init() as void + m.transportImpls = [] + m.top.filters = [] + m.top.excludeFilters = [] + m.top.transports = ["printTransport"] + m.top.functionName = "execRunLoop" + m.pendingItems = [] + m.top.control="run" +end function + +function execRunLoop() + port = CreateObject("roMessagePort") + m.top.observeField("logEntry", port) + + while true + msg = wait(0, port) + if type(msg) = "roSGNodeEvent" + field = msg.getField() + data = msg.getData() + if (field = "logEntry") + if (data <> invalid) + ' addItemToPending(data) + logItem(data) + end if + end if + end if + end while +end function + +function onLogEntryChange() as void + if m.top.logEntry <> invalid + addItemToPending(m.top.logEntry) + end if +end function + +function addItemToPending(item) as void + m.pendingItems.push(item) + if m.pendingItems.count() > 20 + for i = 0 to m.pendingItems.count() -1 + logItem(m.pendingItems[i]) + end for + m.pendingItems = [] + end if +end function + +function logItem(args) as void + passesFilter = m.top.logLevel >= args.level and matchesFilter(args) and not isExcluded(args) + passesFilter = true + for each transport in m.transportImpls + if not transport.managesFiltering or passesFilter + transport.log(args) + end if + end for +end function + +function matchesFilter(args) as boolean + if m.top.filters.count() = 0 + return true + else + for each filter in m.top.filters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function isExcluded(args) as boolean + if m.top.excludeFilters.count() = 0 + return false + else + for each filter in m.top.excludeFilters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function onTransportsChange(event) + print "[METHOD] RLOG.onTransportsChange" + m.transportImpls = [] + for each transportType in m.top.transports + transport = getTransport(transportType) + if transport <> invalid + m.transportImpls.push(transport) + else + print "found illegal transportType " ; transportType + end if + end for +end function + +function getTransport(transportType) + if transportType = "printTransport" + return PrintTransport(m.top) + else if transportType = "rLogSGTransport" + return rLogSGTransport(m.top) + else if transportType = "rLogScreenTransport" + return rLogScreenTransport(m.top) + end if +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.xml b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.xml new file mode 100644 index 00000000..853ff098 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectNoSolos/components/rLogComponents/rLog.xml @@ -0,0 +1,38 @@ + + + + + + \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.brs b/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.brs new file mode 100644 index 00000000..6b3fa324 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.brs @@ -0,0 +1,105 @@ +function Init() as void + m.transportImpls = [] + m.top.filters = [] + m.top.excludeFilters = [] + m.top.transports = ["printTransport"] + m.top.functionName = "execRunLoop" + m.pendingItems = [] + m.top.control="run" +end function + +function execRunLoop() + port = CreateObject("roMessagePort") + m.top.observeField("logEntry", port) + + while true + msg = wait(0, port) + if type(msg) = "roSGNodeEvent" + field = msg.getField() + data = msg.getData() + if (field = "logEntry") + if (data <> invalid) + ' addItemToPending(data) + logItem(data) + end if + end if + end if + end while +end function + +function onLogEntryChange() as void + if m.top.logEntry <> invalid + addItemToPending(m.top.logEntry) + end if +end function + +function addItemToPending(item) as void + m.pendingItems.push(item) + if m.pendingItems.count() > 20 + for i = 0 to m.pendingItems.count() -1 + logItem(m.pendingItems[i]) + end for + m.pendingItems = [] + end if +end function + +function logItem(args) as void + passesFilter = m.top.logLevel >= args.level and matchesFilter(args) and not isExcluded(args) + passesFilter = true + for each transport in m.transportImpls + if not transport.managesFiltering or passesFilter + transport.log(args) + end if + end for +end function + +function matchesFilter(args) as boolean + if m.top.filters.count() = 0 + return true + else + for each filter in m.top.filters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function isExcluded(args) as boolean + if m.top.excludeFilters.count() = 0 + return false + else + for each filter in m.top.excludeFilters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function onTransportsChange(event) + print "[METHOD] RLOG.onTransportsChange" + m.transportImpls = [] + for each transportType in m.top.transports + transport = getTransport(transportType) + if transport <> invalid + m.transportImpls.push(transport) + else + print "found illegal transportType " ; transportType + end if + end for +end function + +function getTransport(transportType) + if transportType = "printTransport" + return PrintTransport(m.top) + else if transportType = "rLogSGTransport" + return rLogSGTransport(m.top) + else if transportType = "rLogScreenTransport" + return rLogScreenTransport(m.top) + end if +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.xml b/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.xml new file mode 100644 index 00000000..853ff098 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyItGroup/components/rLogComponents/rLog.xml @@ -0,0 +1,38 @@ + + + + + + \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.brs b/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.brs new file mode 100644 index 00000000..6b3fa324 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.brs @@ -0,0 +1,105 @@ +function Init() as void + m.transportImpls = [] + m.top.filters = [] + m.top.excludeFilters = [] + m.top.transports = ["printTransport"] + m.top.functionName = "execRunLoop" + m.pendingItems = [] + m.top.control="run" +end function + +function execRunLoop() + port = CreateObject("roMessagePort") + m.top.observeField("logEntry", port) + + while true + msg = wait(0, port) + if type(msg) = "roSGNodeEvent" + field = msg.getField() + data = msg.getData() + if (field = "logEntry") + if (data <> invalid) + ' addItemToPending(data) + logItem(data) + end if + end if + end if + end while +end function + +function onLogEntryChange() as void + if m.top.logEntry <> invalid + addItemToPending(m.top.logEntry) + end if +end function + +function addItemToPending(item) as void + m.pendingItems.push(item) + if m.pendingItems.count() > 20 + for i = 0 to m.pendingItems.count() -1 + logItem(m.pendingItems[i]) + end for + m.pendingItems = [] + end if +end function + +function logItem(args) as void + passesFilter = m.top.logLevel >= args.level and matchesFilter(args) and not isExcluded(args) + passesFilter = true + for each transport in m.transportImpls + if not transport.managesFiltering or passesFilter + transport.log(args) + end if + end for +end function + +function matchesFilter(args) as boolean + if m.top.filters.count() = 0 + return true + else + for each filter in m.top.filters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function isExcluded(args) as boolean + if m.top.excludeFilters.count() = 0 + return false + else + for each filter in m.top.excludeFilters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function onTransportsChange(event) + print "[METHOD] RLOG.onTransportsChange" + m.transportImpls = [] + for each transportType in m.top.transports + transport = getTransport(transportType) + if transport <> invalid + m.transportImpls.push(transport) + else + print "found illegal transportType " ; transportType + end if + end for +end function + +function getTransport(transportType) + if transportType = "printTransport" + return PrintTransport(m.top) + else if transportType = "rLogSGTransport" + return rLogSGTransport(m.top) + else if transportType = "rLogScreenTransport" + return rLogScreenTransport(m.top) + end if +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.xml b/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.xml new file mode 100644 index 00000000..853ff098 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlySuite/components/rLogComponents/rLog.xml @@ -0,0 +1,38 @@ + + + + + + \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.brs b/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.brs new file mode 100644 index 00000000..6b3fa324 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.brs @@ -0,0 +1,105 @@ +function Init() as void + m.transportImpls = [] + m.top.filters = [] + m.top.excludeFilters = [] + m.top.transports = ["printTransport"] + m.top.functionName = "execRunLoop" + m.pendingItems = [] + m.top.control="run" +end function + +function execRunLoop() + port = CreateObject("roMessagePort") + m.top.observeField("logEntry", port) + + while true + msg = wait(0, port) + if type(msg) = "roSGNodeEvent" + field = msg.getField() + data = msg.getData() + if (field = "logEntry") + if (data <> invalid) + ' addItemToPending(data) + logItem(data) + end if + end if + end if + end while +end function + +function onLogEntryChange() as void + if m.top.logEntry <> invalid + addItemToPending(m.top.logEntry) + end if +end function + +function addItemToPending(item) as void + m.pendingItems.push(item) + if m.pendingItems.count() > 20 + for i = 0 to m.pendingItems.count() -1 + logItem(m.pendingItems[i]) + end for + m.pendingItems = [] + end if +end function + +function logItem(args) as void + passesFilter = m.top.logLevel >= args.level and matchesFilter(args) and not isExcluded(args) + passesFilter = true + for each transport in m.transportImpls + if not transport.managesFiltering or passesFilter + transport.log(args) + end if + end for +end function + +function matchesFilter(args) as boolean + if m.top.filters.count() = 0 + return true + else + for each filter in m.top.filters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function isExcluded(args) as boolean + if m.top.excludeFilters.count() = 0 + return false + else + for each filter in m.top.excludeFilters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function onTransportsChange(event) + print "[METHOD] RLOG.onTransportsChange" + m.transportImpls = [] + for each transportType in m.top.transports + transport = getTransport(transportType) + if transport <> invalid + m.transportImpls.push(transport) + else + print "found illegal transportType " ; transportType + end if + end for +end function + +function getTransport(transportType) + if transportType = "printTransport" + return PrintTransport(m.top) + else if transportType = "rLogSGTransport" + return rLogSGTransport(m.top) + else if transportType = "rLogScreenTransport" + return rLogScreenTransport(m.top) + end if +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.xml b/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.xml new file mode 100644 index 00000000..853ff098 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyTests/components/rLogComponents/rLog.xml @@ -0,0 +1,38 @@ + + + + + + \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.brs b/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.brs new file mode 100644 index 00000000..6b3fa324 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.brs @@ -0,0 +1,105 @@ +function Init() as void + m.transportImpls = [] + m.top.filters = [] + m.top.excludeFilters = [] + m.top.transports = ["printTransport"] + m.top.functionName = "execRunLoop" + m.pendingItems = [] + m.top.control="run" +end function + +function execRunLoop() + port = CreateObject("roMessagePort") + m.top.observeField("logEntry", port) + + while true + msg = wait(0, port) + if type(msg) = "roSGNodeEvent" + field = msg.getField() + data = msg.getData() + if (field = "logEntry") + if (data <> invalid) + ' addItemToPending(data) + logItem(data) + end if + end if + end if + end while +end function + +function onLogEntryChange() as void + if m.top.logEntry <> invalid + addItemToPending(m.top.logEntry) + end if +end function + +function addItemToPending(item) as void + m.pendingItems.push(item) + if m.pendingItems.count() > 20 + for i = 0 to m.pendingItems.count() -1 + logItem(m.pendingItems[i]) + end for + m.pendingItems = [] + end if +end function + +function logItem(args) as void + passesFilter = m.top.logLevel >= args.level and matchesFilter(args) and not isExcluded(args) + passesFilter = true + for each transport in m.transportImpls + if not transport.managesFiltering or passesFilter + transport.log(args) + end if + end for +end function + +function matchesFilter(args) as boolean + if m.top.filters.count() = 0 + return true + else + for each filter in m.top.filters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function isExcluded(args) as boolean + if m.top.excludeFilters.count() = 0 + return false + else + for each filter in m.top.excludeFilters + if type(box(filter)) = "roString" and filter = args.name + return true + end if + end for + end if + + return false +end function + +function onTransportsChange(event) + print "[METHOD] RLOG.onTransportsChange" + m.transportImpls = [] + for each transportType in m.top.transports + transport = getTransport(transportType) + if transport <> invalid + m.transportImpls.push(transport) + else + print "found illegal transportType " ; transportType + end if + end for +end function + +function getTransport(transportType) + if transportType = "printTransport" + return PrintTransport(m.top) + else if transportType = "rLogSGTransport" + return rLogSGTransport(m.top) + else if transportType = "rLogScreenTransport" + return rLogScreenTransport(m.top) + end if +end function \ No newline at end of file diff --git a/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.xml b/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.xml new file mode 100644 index 00000000..853ff098 --- /dev/null +++ b/rooibosPreprocessor/src/test/stubProjectOnlyTests_oneFile/components/rLogComponents/rLog.xml @@ -0,0 +1,38 @@ + + + +