-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
TestQuark : UnitTest { | ||
*testQuarkPath { | ||
^PathName(thisMethod.filenameSymbol.asString).pathOnly +/+ "assets" +/+ "TestQuark"; | ||
} | ||
|
||
*tempDir { | ||
^Platform.defaultTempDir +/+ 'testTempDir' +/+ 'testQuark'; | ||
} | ||
|
||
*clearTempDir { | ||
File.delete(TestQuark.tempDir); | ||
} | ||
|
||
*hookNames { | ||
^[ | ||
\preInstall, | ||
\postInstall, | ||
\preUpdate, | ||
\postUpdate, | ||
\preUninstall, | ||
\postUninstall, | ||
]; | ||
} | ||
|
||
test_parseQuarkFileHooksAsFunction { | ||
var quark = Quark.fromLocalPath(TestQuark.testQuarkPath); | ||
TestQuark.hookNames.do({|hookName| | ||
this.assert( | ||
quark.data[hookName].class == Function, | ||
"Hook '%' should be parsed as function".format(hookName), | ||
); | ||
}); | ||
} | ||
|
||
test_runQuarkInstallHooks { | ||
TestQuark.clearTempDir; | ||
// as the quark to be installed is empty we can not update or | ||
// uninstall it. | ||
// Making it non empty does not fix this as it is already | ||
// in a subdir of the testsuite, therefore every class file | ||
// will be already available and a proper Quark install | ||
// is omitted. | ||
Quarks.install(TestQuark.testQuarkPath); | ||
[\preInstall, \postInstall].do({|hookName| | ||
this.assert( | ||
File.exists(TestQuark.tempDir +/+ hookName), | ||
"Check if hook '%' was called".format(hookName); | ||
); | ||
}); | ||
TestQuark.clearTempDir; | ||
} | ||
|
||
test_parseQuarkFileData { | ||
var quark = Quark.fromLocalPath(TestQuark.testQuarkPath); | ||
this.assert( | ||
quark.data[\name] == "DemonWidgets", | ||
"Quark name should be parsed from quark file", | ||
); | ||
this.assert( | ||
quark.data[\version] == "1.0.0", | ||
"Quark version should be parsed from quark file" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
( | ||
name: "DemonWidgets", | ||
summary: "Widgets, gadgets and arcane devices for summoning demons.", | ||
version: "1.0.0", | ||
schelp: "DemonWidgets", | ||
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}, | ||
) |