Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: daf94b93906c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3940be67fd8f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 18, 2015

  1. [Truffle] Testing JRuby against TruffleTCK to verify consistency with…

    … other languages.
    Jaroslav Tulach committed Jun 18, 2015
    Copy the full SHA
    96d5fad View commit details
  2. Merge pull request #3063 from jtulach/TruffleTCK

    [Truffle] Testing JRuby against TruffleTCK to verify consistency with…
    chrisseaton committed Jun 18, 2015
    Copy the full SHA
    3940be6 View commit details
Showing with 82 additions and 0 deletions.
  1. +11 −0 truffle/pom.xml
  2. +71 −0 truffle/src/test/java/org/jruby/truffle/tck/RubyTckTest.java
11 changes: 11 additions & 0 deletions truffle/pom.xml
Original file line number Diff line number Diff line change
@@ -32,6 +32,17 @@
<version>0.8-ef8c90391f1ec21bcfb6d5c6fb39757b860d4973-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>truffle-tck</artifactId>
<version>0.8-ef8c90391f1ec21bcfb6d5c6fb39757b860d4973-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
71 changes: 71 additions & 0 deletions truffle/src/test/java/org/jruby/truffle/tck/RubyTckTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.tck;

import com.oracle.truffle.api.vm.TruffleVM;
import com.oracle.truffle.tck.TruffleTCK;

import org.junit.Test;
import static org.junit.Assert.*;

public class RubyTckTest extends TruffleTCK {
@Test
public void checkVM() {
TruffleVM vm = TruffleVM.newVM().build();
assertNotNull(vm.getLanguages().get("application/x-ruby"));
}

@Override
protected TruffleVM prepareVM() throws Exception {
// @formatter:off
TruffleVM jsVM = TruffleVM.newVM().build();
jsVM.eval("application/x-ruby",
"def sum a, b\n"
+ " return a + b\n"
+ "end\n"
+ "def fourtyTwo\n"
+ " return 42\n"
+ "end\n"
+ "def retNil\n"
+ " return nil\n"
+ "end\n"
+ "Truffle::Interop.export(\"sumInts\", method(:sum))\n"
+ "Truffle::Interop.export(\"fourtyTwo\", method(:fourtyTwo))\n"
+ "Truffle::Interop.export(\"retNil\", method(:retNil))\n"
);
// @formatter:on
return jsVM;
}

@Override
protected String plusInt() {
return "sumInts";
}

@Override
protected String fourtyTwo() {
return "fourtyTwo";
}

@Override
protected String mimeType() {
return "application/x-ruby";
}

@Override
protected String returnsNull() {
return "retNil";
}

@Override
protected String invalidCode() {
return "def something\n ret urn 4.2\ne n d";
}
}