Skip to content

Instantly share code, notes, and snippets.

@scztt
Last active August 29, 2015 14:19
Show Gist options
  • Save scztt/da81d2531f77fefa5c0d to your computer and use it in GitHub Desktop.
Save scztt/da81d2531f77fefa5c0d to your computer and use it in GitHub Desktop.
Test Quarks.load and Quarks.save functions
(
var root = "/a/b/c";
var testSpec = {
|a, b|
a = Quarks.parseQuarkSpecifier(a, root);
"%: % == %".format(a == b, a, b).postln;
};
var testSaved = {
|a, b|
a = Quarks.savedQuarkSpecifier(a, root);
"%: % == %".format(a == b, a, b).postln;
};
var quark;
// loading
testSpec.( "someQuark", ["someQuark", ""]);
testSpec.( "someQuark@1.2.3", ["someQuark", "1.2.3"]);
testSpec.( "./someQuark", [root +/+ "someQuark", ""]);
testSpec.( "./someQuark@1.2.3", [root +/+ "someQuark", "1.2.3"]);
testSpec.( "/path/to/someQuark", ["/path/to/someQuark", ""]);
testSpec.( "/path/to/someQuark@1.2.3", ["/path/to/someQuark", "1.2.3"]);
testSpec.( "git://github.com/user/quark.git", ["git://github.com/user/quark.git", ""]);
testSpec.( "git://github.com/user/quark.git@1.2.3", ["git://github.com/user/quark.git", "1.2.3"]);
testSpec.( "http://github.com/user/quark.git", ["http://github.com/user/quark.git", ""]);
testSpec.( "http://github.com/user/quark.git@1.2.3", ["http://github.com/user/quark.git", "1.2.3"]);
testSpec.( "./someQuark=someQuark", [root +/+ "someQuark", ""]);
testSpec.( "./someQuark=someQuark@1.2.3", [root +/+ "someQuark", "1.2.3"]);
testSpec.( "/path/to/someQuark=someQuark", ["/path/to/someQuark", ""]);
testSpec.( "/path/to/someQuark=someQuark@1.2.3", ["/path/to/someQuark", "1.2.3"]);
// saving
quark = (
name: "someQuark",
url: "http://github.com/user/quark.git",
refspec: "",
localPath: root +/+ "someQuark"
);
testSaved.( quark, "./someQuark=someQuark");
quark.localPath = "/some/other/path/someQuark";
testSaved.( quark, "/some/other/path/someQuark=someQuark");
Quarks.install("cruciallib");
quark.name = "cruciallib";
quark.localPath = Quarks.folder +/+ "cruciallib";
testSaved.( quark, "cruciallib");
quark.refspec = "1.2.3";
testSaved.( quark, "cruciallib@1.2.3");
quark.localPath = "/not/in/quarks/dir/cruciallib";
testSaved.( quark, "/not/in/quarks/dir/cruciallib=cruciallib");
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment