Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit-tests for Joda convert. #45

Merged
merged 2 commits into from
Oct 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libraryBuilds/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ gradlew.bat
# Generated by prep.sh
common/local.properties
localJ2objcDist/

# Generated by prep-tests.sh
test
test-repo/
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ dependencies {
}

j2objcConfig {
// package-info.java exists in multiple packages.
filenameCollisionCheck false

// Almost always there are no tests provided in an external source jar.
testMinExpectedTests 0
finalConfigure()
Expand Down
28 changes: 28 additions & 0 deletions libraryBuilds/common/prep-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
#
# 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.

set -v
rm -rf test-repo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be "repo" instead of "test-repo"? Though it's used for testing, it is just a copy of the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this script is currently called prep-tests.sh, and there is no requirement that the repo one specifies to this script have anything but unit tests. if we generalize this script to handle main source set later, then we should rename.

rm -rf src/test
rm -rf src

set -ev
TAG=$1
REPO=$2
TEST_DIR_IN_REPO=$3
git clone --depth 1 --branch $TAG $REPO test-repo
mkdir src
cp -R test-repo/$TEST_DIR_IN_REPO src/test
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ dependencies {
}

j2objcConfig {
// package-info.java in multiple packages.
filenameCollisionCheck false

// Blocked on https://github.com/j2objc-contrib/j2objc-gradle/issues/465
// to support test-sources.jar.
testMinExpectedTests 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@
dependencies {
j2objcTranslation 'org.joda:joda-convert:1.8:sources'
compile 'com.google.guava:guava:18.0'
testCompile 'junit:junit:4.11'
}

j2objcConfig {
testPattern {
// Do not include subdirectories of convert. Their files prefixed with Test
// are support classes, not tests.
include '**/convert/Test*'
// https://github.com/j2objc-contrib/j2objc-common-libs-e2e-test/issues/46
exclude '**/TestGuavaTypeTokenStringConverter*'
exclude '**/TestJDKStringConverters*'
exclude '**/TestNumericObjectArrayStringConverterFactory*'
exclude '**/TestStringConvert*'
}
autoConfigureDeps true

// No tests in the sources.jar.
testMinExpectedTests 0
finalConfigure()
}
17 changes: 17 additions & 0 deletions libraryBuilds/org.joda-joda-convert/org.joda-joda-convert/prep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#
# Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
#
# 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.

../../common/prep-tests.sh v1.8 https://github.com/JodaOrg/joda-convert src/test
17 changes: 15 additions & 2 deletions libraryBuilds/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@
set -ev

TEST_DIR=$1
echo Running test $TEST_DIR
pushd $TEST_DIR

echo Preparing test $TEST_DIR

# Execute the prep.sh files within this project, if any.
# These are often used to retrieve test sources for the libraries.
# -L follows symbolic links correctly.
find -L . -name prep.sh | while read PREP_SCRIPT_FILE
do
pushd `dirname $PREP_SCRIPT_FILE`
sh prep.sh
popd
done

echo Running test $TEST_DIR
./gradlew wrapper
./gradlew clean
./gradlew build
./gradlew build --stacktrace
popd