Skip to content

Commit

Permalink
Add tests for testCompile and j2objcTestLinkage to multiProject1.
Browse files Browse the repository at this point in the history
multiProject1 system test also checks that duplicate transitive dependencies function correctly.
  • Loading branch information
advayDev1 committed Oct 6, 2015
1 parent b7f7114 commit 20cdb42
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 5 deletions.
3 changes: 3 additions & 0 deletions systemTests/multiProject1/base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ dependencies {
// Intentionally testing e2e use of a built-in j2objc library, Guava.
compile 'com.google.guava:guava:17.0'
testCompile 'junit:junit:4.12'
testCompile project(':testLib')
}

j2objcConfig {
autoConfigureDeps true

finalConfigure()
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public void testToString() {

@Test
public void testExerciseGuava() {
Assert.assertEquals("a b c", new Cube(7).exerciseGuava());
Assert.assertEquals(CubeTester.exerciseGuavaInTests(" "), new Cube(7).exerciseGuava());
}
}
1 change: 1 addition & 0 deletions systemTests/multiProject1/extended/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
// translates and links it in to the compiled library. No further configuration is required.
compile 'com.google.code.gson:gson:2.3.1'
testCompile 'junit:junit:4.12'
testCompile project(':testLib')
}

j2objcConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public void testToString() {

@Test
public void testExerciseGuava() {
Assert.assertEquals("a;b;c", new ExtendedCube(7).exerciseGuava());
Assert.assertEquals(CubeTester.exerciseGuavaInTests(";"), new ExtendedCube(7).exerciseGuava());
}
}
2 changes: 1 addition & 1 deletion systemTests/multiProject1/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
include ':base', ':extended'
include ':testLib', ':base', ':extended'
34 changes: 34 additions & 0 deletions systemTests/multiProject1/testLib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'java'
apply plugin: 'com.github.j2objccontrib.j2objcgradle'

repositories {
jcenter()
}

dependencies {
// Intentionally testing e2e use of a built-in j2objc library, Guava.
compile 'com.google.guava:guava:17.0'
testCompile 'junit:junit:4.12'
}

j2objcConfig {
autoConfigureDeps true

finalConfigure()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example;

import com.google.common.base.Joiner;

public class CubeTester {

public static String exerciseGuavaInTests(String space) {
return Joiner.on(space).join('a', 'b', 'c');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2015 the authors of j2objc-gradle (see AUTHORS file)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example;

import org.junit.Assert;
import org.junit.Test;

public class CubeTesterTest {

@Test
public void testExerciseGuavaInTests() {
Assert.assertEquals("a_b_c", CubeTester.exerciseGuavaInTests("_"));
}
}
5 changes: 3 additions & 2 deletions systemTests/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ function runTest {
# Simplest possible set-up. A single project with no dependencies.
runTest simple1

# Two gradle projects, `extended` depends on `base`. They also both test
# Two main gradle projects, `extended` depends on `base`. They also both test
# dependency on built-in j2objc libraries, like Guava, and build-closure
# based translation of an external library, Gson.
# based translation of an external library, Gson. They also both depend
# depend on a third test-only gradle project, `testLib`.
runTest multiProject1

# TODO: Re-enable building Guava when we figure out how to deal with Java 8.
Expand Down

0 comments on commit 20cdb42

Please sign in to comment.