Skip to content

Commit

Permalink
Add Duktape 2.4.0 to the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
fstirlitz committed Oct 20, 2019
1 parent bc714a6 commit 84e7a67
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ before_install:
- PACKAGE=Rhino1_7R4_RELEASE; echo -e '#!/bin/sh\njava -jar /opt/Rhino1_7R4_RELEASE/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino
- PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip
- PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo
# If the enviroment stores rt.jar in a different directory, find it and symlink the directory
- PREFIX=/usr/lib/jvm; if [ ! -d $PREFIX/java-6-openjdk ]; then for d in $PREFIX/java-6-openjdk-*; do if [ -e $d/jre/lib/rt.jar ]; then sudo ln -s $d $PREFIX/java-6-openjdk; break; fi; done; fi
# Duktape
- sudo apt-get update -qq
- sudo apt-get install -qq make gcc
- PACKAGE=duktape-2.4.0; wget "https://duktape.org/$PACKAGE.tar.xz" && tar xf "$PACKAGE.tar.xz" && make -C "$PACKAGE/" -f Makefile.cmdline DEFINES=-DDUK_CMDLINE_FILEIO && sudo install -Dm755 "$PACKAGE/duk" /usr/local/bin/duk && rm -rf "$PACKAGE.tar.xz" "$PACKAGE/"
before_deploy:
- make build
deploy:
Expand Down
35 changes: 34 additions & 1 deletion test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,46 @@
// Use the console reporter
, isConsole = typeof process == 'object' && process.argv && process.argv.indexOf('--console') >= 0;

function makeLoader(readTextFile) {
function loadModule(id, filename) {
/*jshint evil:true */
var filedir = filename.replace(/[^/]+$/, '') || '.';
var loader = new Function(
"require", "exports", "module",
readTextFile(filename)
);
var module = {
id: id,
exports: {}
};
loader(
function (what) { return loadModule(what, filedir + '/' + what + '.js'); },
module.exports, module
);

return module.exports;
}

return loadModule;
}

var load = function load(mod, path) {
if (root[mod]) return root[mod];
if (isModule) return require(path);
var filename = path.replace(/\.js$/, '') + '.js';

if (isEngine) {
root.load(path.replace(/\.js$/, '') + '.js');
root.load(filename);
return root[mod];
}

// Duktape
if (typeof Duktape !== 'undefined' && typeof readFile === 'function') {
return root[mod] = makeLoader(function (filename) {
/*global readFile, TextDecoder */
return (new TextDecoder('utf-8')).decode(readFile(filename));
})(mod, filename);
}
};

var Spec = load('Spec', './lib/spec')
Expand Down
6 changes: 6 additions & 0 deletions testem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ launchers:
command: cd test; d8 runner.js
protocol: tap

duktape:
command: cd test; duk runner.js
protocol: tap

launch_in_ci:
- node
- ringo
- rhino
- duktape

launch_in_dev:
- Opera
Expand All @@ -38,5 +43,6 @@ launch_in_dev:
- ringo
- rhino
- rhino1.7R5
- duktape
- nashorn
- d8

0 comments on commit 84e7a67

Please sign in to comment.