codemodels-java 0.2.2-java → 0.2.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemodels/java/parser.rb +3 -3
- data/lib/codemodels/java/version.rb +1 -1
- data/test/test_correspondences.rb +13 -18
- data/test/test_info_extraction.rb +5 -5
- data/test/test_parsing.rb +1 -1
- data/test/test_values.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f293a86cf023cdb2590b4e82132ae9114994e4
|
4
|
+
data.tar.gz: d90b243ffa435bea75d897bbcf075a2b33c3073b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b6454c06acf83765f22df2ac67c1dfee0d624aed3acd6e38dec104d8b008d8a284b9b7ab48b73d45b920385214651664cc77edfa7dcc61d3768d76958f1fb9
|
7
|
+
data.tar.gz: bde39beec8ae2461317f3f21fc89f482d93de529fd8a2fbf65b7a0ef87dc0b598ab4c14eb40014835dce0fec0c182a5395c16dc5cb34e18bf5a2ebad87f01dc7
|
@@ -33,7 +33,7 @@ class Parser < CodeModels::JavaParserWrapper::ParserJavaWrapper
|
|
33
33
|
java_import 'java.io.ByteArrayInputStream'
|
34
34
|
|
35
35
|
def initialize()
|
36
|
-
super
|
36
|
+
super()
|
37
37
|
@transformer.factory = MyBasicTransformationFactory.new
|
38
38
|
@transformer.factory.target_module = CodeModels::Java
|
39
39
|
end
|
@@ -81,8 +81,8 @@ class Parser < CodeModels::JavaParserWrapper::ParserJavaWrapper
|
|
81
81
|
corresponding_node(model_element,node_tree)
|
82
82
|
end
|
83
83
|
|
84
|
-
def
|
85
|
-
node_to_model(node_tree_from_code(code))
|
84
|
+
def internal_parse_artifact(artifact)
|
85
|
+
node_to_model(node_tree_from_code(artifact.code))
|
86
86
|
end
|
87
87
|
|
88
88
|
def get_corresponding_metaclass(node)
|
@@ -8,24 +8,19 @@ class TestCorrespondences < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
J = CodeModels::Java
|
10
10
|
|
11
|
-
def test_correspondance_of_field
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
assert_equal node_field, J::DefaultParser.corresponding_node(model_field,nt)
|
18
|
-
assert_equal "int fieldB;", J::DefaultParser.corresponding_node(model_field,nt).to_s
|
19
|
-
end
|
11
|
+
# def test_correspondance_of_field
|
12
|
+
# code = "class A extends B { int fieldB; int getB(){ return fieldB; } }"
|
13
|
+
# nt = CodeModels.parse_string(code,:Java)
|
14
|
+
# node_field = nt.types[0].members[0]
|
15
|
+
# assert_equal "int fieldB;", node_field.to_s
|
16
|
+
# end
|
20
17
|
|
21
|
-
def test_corresponding_node_from_code
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
assert_equal "int fieldB;", J::DefaultParser.corresponding_node_from_code(model_field,code).to_s
|
29
|
-
end
|
18
|
+
# def test_corresponding_node_from_code
|
19
|
+
# code = "class A extends B { int fieldB; int getB(){ return fieldB; } }"
|
20
|
+
# nt = CodeModels.parse_string(code,:Java)
|
21
|
+
# node_field = nt.types[0].members[0]
|
22
|
+
# assert_equal node_field, J::DefaultParser.corresponding_node_from_code(model_field,code)
|
23
|
+
# assert_equal "int fieldB;", J::DefaultParser.corresponding_node_from_code(model_field,code).to_s
|
24
|
+
# end
|
30
25
|
|
31
26
|
end
|
@@ -7,10 +7,10 @@ class TestInfoExtraction < Test::Unit::TestCase
|
|
7
7
|
include TestHelper
|
8
8
|
|
9
9
|
def setup
|
10
|
-
@actionbuttonscomumntag_model_node = CodeModels
|
11
|
-
@csvexporter_model_node = CodeModels
|
12
|
-
@authconstraint_model_node = CodeModels
|
13
|
-
@testiteration_model_node = CodeModels
|
10
|
+
@actionbuttonscomumntag_model_node = CodeModels.parse_string(read_test_data('ActionButtonsColumnTag.java'),:Java)
|
11
|
+
@csvexporter_model_node = CodeModels.parse_string(read_test_data('CsvExporter.java'),:Java)
|
12
|
+
@authconstraint_model_node = CodeModels.parse_string(read_test_data('AuthConstraint.java'),:Java)
|
13
|
+
@testiteration_model_node = CodeModels.parse_string(read_test_data('TestIteration.java'),:Java)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_camel_to_words_single_word_upcase
|
@@ -98,7 +98,7 @@ class TestInfoExtraction < Test::Unit::TestCase
|
|
98
98
|
'false' => 2,
|
99
99
|
'other' => 3
|
100
100
|
}
|
101
|
-
model_node = CodeModels
|
101
|
+
model_node = CodeModels.parse_string(code,:Java)
|
102
102
|
terms_map = model_node.terms_map
|
103
103
|
assert_map_equal exp_terms,terms_map,model_node.to_json
|
104
104
|
end
|
data/test/test_parsing.rb
CHANGED
@@ -136,7 +136,7 @@ class TestParsing < Test::Unit::TestCase
|
|
136
136
|
}
|
137
137
|
}
|
138
138
|
}
|
139
|
-
model = CodeModels
|
139
|
+
model = CodeModels.parse_string(code,:Java)
|
140
140
|
m = model.types[0].members[0]
|
141
141
|
assert_class ClassMethodDeclaration,m
|
142
142
|
assert_class BlockStmt,m.body
|
data/test/test_values.rb
CHANGED
@@ -15,13 +15,13 @@ class TestValues < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def assert_code_map_to(code,exp)
|
18
|
-
r = CodeModels
|
18
|
+
r = CodeModels.parse_string(code,:Java)
|
19
19
|
map = r.values_map
|
20
20
|
assert_map(exp,map,r.to_json)
|
21
21
|
end
|
22
22
|
|
23
23
|
def assert_method_code_map_to(code,exp)
|
24
|
-
r = CodeModels
|
24
|
+
r = CodeModels.parse_string("class A { #{code} }",:Java)
|
25
25
|
m = r.types[0].members[0]
|
26
26
|
map = m.values_map
|
27
27
|
assert_map(exp,map,m.to_json)
|