| 15 | |
| 16 | |
| 17 | void CustomScriptTest::test() { |
| 18 | |
| 19 | TestUtils utils; |
| 20 | |
| 21 | #ifdef Q_OS_UNIX |
| 22 | QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC"); |
| 23 | auto comapareTree = utils.createTree( |
| 24 | {"./" + DISTRO_DIR + "/bin/TestOnlyC", |
| 25 | "./" + DISTRO_DIR + "/bin/qt.conf", |
| 26 | "./" + DISTRO_DIR + "/TestOnlyC.sh"}); |
| 27 | QString bin = TestBinDir + "TestOnlyC"; |
| 28 | QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.sh"; |
| 29 | |
| 30 | #else |
| 31 | QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe"); |
| 32 | auto comapareTree = utils.createTree( |
| 33 | {"./" + DISTRO_DIR + "/TestOnlyC.exe", |
| 34 | "./" + DISTRO_DIR + "/TestOnlyC.bat", |
| 35 | "./" + DISTRO_DIR + "/qt.conf"}); |
| 36 | QString bin = TestBinDir + "TestOnlyC.exe"; |
| 37 | QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.bat"; |
| 38 | |
| 39 | |
| 40 | #endif |
| 41 | |
| 42 | runTestParams({"-bin", bin, "force-clear", "noOverwrite", "-libOut", "lib"}, &comapareTree); |
| 43 | |
| 44 | QFile script(scriptPath); |
| 45 | QVERIFY(script.open(QIODevice::ReadOnly)); |
| 46 | auto scriptText = script.readAll(); |
| 47 | |
| 48 | QVERIFY(!scriptText.contains("Begin Custom Script")); |
| 49 | |
| 50 | script.close(); |
| 51 | |
| 52 | runTestParams({"-bin", bin, "force-clear", "noOverwrite", |
| 53 | "-libOut", "lib", |
| 54 | "-customScript", "echo 'this is test script'"}, &comapareTree); |
| 55 | |
| 56 | QVERIFY(script.open(QIODevice::ReadOnly)); |
| 57 | |
| 58 | scriptText = script.readAll(); |
| 59 | |
| 60 | QVERIFY(scriptText.contains("Begin Custom Script")); |
| 61 | QVERIFY(scriptText.contains("echo 'this is test script'")); |
| 62 | QVERIFY(scriptText.contains("End Custom Script")); |
| 63 | |
| 64 | script.close(); |
| 65 | |
| 66 | |
| 67 | |
| 68 | } |
| 69 |
nothing calls this directly
no test coverage detected