Skip to content

Commit

Permalink
test: change test method
Browse files Browse the repository at this point in the history
Instead of writing files, set values in a class variable.
  • Loading branch information
telephon committed Dec 23, 2022
1 parent 8740269 commit 88ddbd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions testsuite/classlibrary/TestQuark.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
TestQuark : UnitTest {
classvar <>testResults;

*initClass { testResults = () }

*testQuarkPath {
^PathName(thisMethod.filenameSymbol.asString).pathOnly +/+ "assets" +/+ "TestQuark";
}
Expand Down Expand Up @@ -43,11 +47,12 @@ TestQuark : UnitTest {
Quarks.install(TestQuark.testQuarkPath);
[\preInstall, \postInstall].do({|hookName|
this.assert(
File.exists(TestQuark.tempDir +/+ hookName),
"Check if hook '%' was called".format(hookName);
testResults[hookName] == true,
"Hook '%' should have been called".format(hookName);
);
});
TestQuark.clearTempDir;
testResults = ();
}

test_parseQuarkFileData {
Expand Down
12 changes: 6 additions & 6 deletions testsuite/classlibrary/assets/TestQuark/TestQuark.quark
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
dependencies: [],
license: "GPL",
copyright: "Frank Furter, Dr.-Ing. 2015",
preInstall: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'preInstall', "w").close},
postInstall: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'postInstall', "w").close},
preUpdate: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'preUpdate', "w").close},
postUpdate: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'postUpdate', "w").close},
preUninstall: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'preUninstall', "w").close},
postUninstall: {File.new(Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark' +/+ 'postUninstall', "w").close},
preInstall: { TestQuark.testResults['preInstall'] = true },
postInstall: { TestQuark.testResults['postInstall'] = true },
preUpdate: { TestQuark.testResults['preUpdate'] = true },
postUpdate: { TestQuark.testResults['postUpdate'] = true },
preUninstall: { TestQuark.testResults['preUninstall'] = true },
postUninstall: { TestQuark.testResults['postUninstall'] = true },
)

0 comments on commit 88ddbd0

Please sign in to comment.