cacert-testmgr/external/ZendFramework-1.9.5/externals/dojo/util/shrinksafe/tests/module.js
Markus Warg 8398c9048d initially import ZendFramework-1.9.5 into repository
code was modified slightly, so the code differs from the original downloadable 1.9.5 version
2010-03-31 10:12:32 +02:00

31 lines
934 B
JavaScript

dojo.provide("shrinksafe.tests.module");
shrinksafe.tests.module.getContents = function(path){
path = "../shrinksafe/tests/" + path;
return readFile(path);
}
shrinksafe.tests.module.compress = function(source){
return new String(Packages.org.dojotoolkit.shrinksafe.Compressor.compressScript(source, 0, 1)).toString();
}
try{
tests.register("shrinksafe",
[
function nestedReference(t){
var original = shrinksafe.tests.module.getContents("5303.js");
var compressed = shrinksafe.tests.module.compress(original);
t.assertTrue(original.length > compressed.length);
t.assertTrue(compressed.indexOf("say_hello") == -1)
t.assertTrue(compressed.indexOf("callback") == -1)
eval(compressed);
// make sure it runs to completion
t.assertEqual("hello worldhello world", result);
// globals must not be renamed
t.assertEqual("function", typeof CallMe);
delete result;
}
]);
}catch(e){
doh.debug(e);
}