Skip to content

Instantly share code, notes, and snippets.

@peterkir
Forked from brunoborges/url-sanity.js
Last active August 29, 2015 14:22
Show Gist options
  • Save peterkir/f215375b9e2d1f1ccc0a to your computer and use it in GitHub Desktop.
Save peterkir/f215375b9e2d1f1ccc0a to your computer and use it in GitHub Desktop.
#!/usr/bin/env jjs
function runTest() {
var URL = Packages.java.net.URL;
var LinkedHashSet = Packages.java.util.LinkedHashSet;
set = new LinkedHashSet();
set.add(new URL("http://Square.GitHub.io/"));
set.add(new URL("http://square.github.io:80/"));
set.add(new URL("http://google.github.io/"));
size = set.size();
if (size === 2) {
print("============= CORRECT ===========");
} else {
print("Awkward... ");
}
}
function callExternalNashorn() {
for (i = 0; i < 100; i++) {
script = __FILE__;
$EXEC('jjs -Dsanity=true -scripting ' + script);
print($OUT);
}
}
if (java.lang.System.getProperty("sanity") === "true") {
runTest();
} else {
callExternalNashorn();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment