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.( "[email protected]", ["someQuark", "1.2.3"]);
testSpec.( "./someQuark", [root +/+ "someQuark", ""]);
testSpec.( "./[email protected]", [root +/+ "someQuark", "1.2.3"]);
testSpec.( "/path/to/someQuark", ["/path/to/someQuark", ""]);
testSpec.( "/path/to/[email protected]", ["/path/to/someQuark", "1.2.3"]);
testSpec.( "git://github.com/user/quark.git", ["git://github.com/user/quark.git", ""]);
testSpec.( "git://github.com/user/[email protected]", ["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/[email protected]", ["http://github.com/user/quark.git", "1.2.3"]);
testSpec.( "./someQuark=someQuark", [root +/+ "someQuark", ""]);
testSpec.( "./[email protected]", [root +/+ "someQuark", "1.2.3"]);
testSpec.( "/path/to/someQuark=someQuark", ["/path/to/someQuark", ""]);
testSpec.( "/path/to/[email protected]", ["/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, "[email protected]");
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