Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a test case and suite to the build for Duby, and start buildin…
…g out some better test cases. git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@6185 961051c9-f516-0410-bf72-c9f7e237a7b7
- Loading branch information
Showing
7 changed files
with
116 additions
and
45 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'test/unit' | ||
require 'compiler/duby/compiler' | ||
require 'jruby' | ||
|
||
class TestCompiler < Test::Unit::TestCase | ||
def setup | ||
@file_builder = Compiler::FileBuilder.new(__FILE__) | ||
end | ||
|
||
def test_class | ||
node = JRuby.parse " | ||
class TestClass | ||
def initialize | ||
end | ||
def self.foo | ||
end | ||
end | ||
class TestClass2 | ||
def foo | ||
@a = 1 | ||
end | ||
end | ||
" | ||
node.compile(@file_builder) | ||
|
||
assert_equal(2, @file_builder.class_builders.size) | ||
class_builder1 = @file_builder.class_builders["TestClass"] | ||
class_builder2 = @file_builder.class_builders["TestClass2"] | ||
|
||
assert_equal("TestClass", class_builder1.class_name) | ||
assert_equal("TestClass2", class_builder2.class_name) | ||
|
||
assert_equal(0, class_builder1.instance_methods.size) | ||
assert_equal(1, class_builder2.instance_methods.size) | ||
assert_equal(1, class_builder1.static_methods.size) | ||
assert_equal(0, class_builder2.static_methods.size) | ||
assert_not_nil(class_builder1.constructor) | ||
assert_nil(class_builder2.constructor) | ||
|
||
assert_equal(0, class_builder1.fields.size) | ||
# fields do not get declared until compile phase right now :( | ||
#assert_equal(1, class_builder2.fields.size) | ||
#assert_equal("int", class_builder2.fields["a"].type.to_s) | ||
end | ||
end |
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 @@ | ||
compiler/duby/test_compiler |
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,28 @@ | ||
/* | ||
* TestUnitTestSuite.java | ||
* JUnit based test | ||
* | ||
* Created on January 15, 2007, 4:06 PM | ||
*/ | ||
|
||
package org.jruby.test; | ||
|
||
|
||
import junit.framework.Test; | ||
import junit.framework.TestSuite; | ||
|
||
|
||
/** | ||
* | ||
* @author headius | ||
*/ | ||
public class DubyTestSuite extends TestSuite { | ||
public static final String TEST_INDEX = "duby_index"; | ||
|
||
/** | ||
* suite method automatically generated by JUnit module | ||
*/ | ||
public static Test suite() throws Exception { | ||
return new TestUnitTestSuite(TEST_INDEX); | ||
} | ||
} |