Skip to content

Commit 1d19747

Browse files
committed
Merge pull request #45 from madvay/jodaTests
Add unit-tests for Joda convert.
2 parents 8144a8e + 43dea79 commit 1d19747

File tree

8 files changed

+76
-11
lines changed

8 files changed

+76
-11
lines changed

libraryBuilds/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ gradlew.bat
99
# Generated by prep.sh
1010
common/local.properties
1111
localJ2objcDist/
12+
13+
# Generated by prep-tests.sh
14+
test
15+
test-repo/

libraryBuilds/com.google.code.gson-gson/com.google.code.gson-gson/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ dependencies {
1919
}
2020

2121
j2objcConfig {
22-
// package-info.java exists in multiple packages.
23-
filenameCollisionCheck false
24-
2522
// Almost always there are no tests provided in an external source jar.
2623
testMinExpectedTests 0
2724
finalConfigure()

libraryBuilds/common/prep-tests.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -v
18+
rm -rf test-repo
19+
rm -rf src/test
20+
rm -rf src
21+
22+
set -ev
23+
TAG=$1
24+
REPO=$2
25+
TEST_DIR_IN_REPO=$3
26+
git clone --depth 1 --branch $TAG $REPO test-repo
27+
mkdir src
28+
cp -R test-repo/$TEST_DIR_IN_REPO src/test

libraryBuilds/org.apache.commons-commons-lang3/org.apache.commons-commons-lang3/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ dependencies {
1919
}
2020

2121
j2objcConfig {
22-
// package-info.java in multiple packages.
23-
filenameCollisionCheck false
24-
2522
// Blocked on https://github.com/j2objc-contrib/j2objc-gradle/issues/465
2623
// to support test-sources.jar.
2724
testMinExpectedTests 0

libraryBuilds/org.joda-joda-convert/org.joda-joda-convert/build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@
1717
dependencies {
1818
j2objcTranslation 'org.joda:joda-convert:1.8:sources'
1919
compile 'com.google.guava:guava:18.0'
20+
testCompile 'junit:junit:4.11'
2021
}
2122

2223
j2objcConfig {
24+
testPattern {
25+
// Do not include subdirectories of convert. Their files prefixed with Test
26+
// are support classes, not tests.
27+
include '**/convert/Test*'
28+
// https://github.com/j2objc-contrib/j2objc-common-libs-e2e-test/issues/46
29+
exclude '**/TestGuavaTypeTokenStringConverter*'
30+
exclude '**/TestJDKStringConverters*'
31+
exclude '**/TestNumericObjectArrayStringConverterFactory*'
32+
exclude '**/TestStringConvert*'
33+
}
2334
autoConfigureDeps true
2435

25-
// No tests in the sources.jar.
26-
testMinExpectedTests 0
2736
finalConfigure()
2837
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
../../common/prep-tests.sh v1.8 https://github.com/JodaOrg/joda-convert src/test

libraryBuilds/run-test.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,22 @@
1818
set -ev
1919

2020
TEST_DIR=$1
21-
echo Running test $TEST_DIR
2221
pushd $TEST_DIR
22+
23+
echo Preparing test $TEST_DIR
24+
25+
# Execute the prep.sh files within this project, if any.
26+
# These are often used to retrieve test sources for the libraries.
27+
# -L follows symbolic links correctly.
28+
find -L . -name prep.sh | while read PREP_SCRIPT_FILE
29+
do
30+
pushd `dirname $PREP_SCRIPT_FILE`
31+
sh prep.sh
32+
popd
33+
done
34+
35+
echo Running test $TEST_DIR
2336
./gradlew wrapper
2437
./gradlew clean
25-
./gradlew build
38+
./gradlew build --stacktrace
2639
popd

0 commit comments

Comments
 (0)