forked from joeferner/node-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for java -source 1.8 Also change Travis to use 3x3 test matrix (jdk x nvm).
- Loading branch information
Showing
12 changed files
with
108 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
language: node_js | ||
node_js: | ||
- "0.11" | ||
- "0.10" | ||
- "0.8" | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
- oraclejdk7 | ||
- openjdk6 | ||
env: | ||
- NODE_VERSION="0.11" | ||
- NODE_VERSION="0.10" | ||
- NODE_VERSION="0.8" | ||
before_install: | ||
- nvm install $NODE_VERSION | ||
before_script: | ||
- npm install | ||
script: | ||
- npm test | ||
notifications: | ||
email: | ||
on_success: "never" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash -e | ||
|
||
# This script must be run on a Mac due to its reliance on /usr/libexec/java_home | ||
# to find a JDK 1.8 installation. Note that this script will work correctly on | ||
# a mac with JDK 1.8 installed, even if JAVA_HOME currently points to a 1.7 | ||
# or earlier JDK. | ||
# This script is run manually by maintainers of this project, who add the | ||
# the generated .class files to source control. | ||
|
||
JAVA_VERSION=1.8 | ||
JDK8_HOME=$(/usr/libexec/java_home -v ${JAVA_VERSION}) | ||
|
||
cd test8 | ||
${JDK8_HOME}/bin/javac -source ${JAVA_VERSION} *.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class TestLambda | ||
{ | ||
public TestLambda() {} | ||
|
||
interface IntegerMath { | ||
int op(int a, int b); | ||
} | ||
|
||
public int testLambdaAddition(Integer x, Integer y) { | ||
IntegerMath addition = (a, b) -> a + b; | ||
return addition.op(x, y); | ||
} | ||
|
||
public int testLambdaSubtraction(Integer x, Integer y) { | ||
IntegerMath subtraction = (a, b) -> a - b; | ||
return subtraction.op(x, y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var java = require("../testHelpers").java; | ||
|
||
var nodeunit = require("nodeunit"); | ||
var util = require("util"); | ||
|
||
exports['Java8'] = nodeunit.testCase({ | ||
"call methods of a class that uses lambda expressions": function(test) { | ||
try { | ||
var TestLambda = java.import('TestLambda'); | ||
var lambda = new TestLambda(); | ||
var sum = lambda.testLambdaAdditionSync(23, 42); | ||
test.equal(sum, 65); | ||
var diff = lambda.testLambdaSubtractionSync(23, 42); | ||
test.equal(diff, -19); | ||
} | ||
catch (err) { | ||
var unsupportedVersion = err.toString().match(/Unsupported major.minor version 52.0/) | ||
test.ok(unsupportedVersion); | ||
if (unsupportedVersion) | ||
console.log('JRE 1.8 not available'); | ||
else | ||
console.error('Java8 test failed with unknown error:', err); | ||
} | ||
test.done(); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters