forked from junit-team/junit4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes junit-teamgh-309: build.xml uploads junitX.jar as junit-depX.jar
- Loading branch information
Showing
11 changed files
with
243 additions
and
68 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
Binary file not shown.
File renamed without changes.
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
set -e | |||
set -o pipefail | |||
|
|||
function TEST_junit_dep_49_plays_not_nicely_with_later_hamcrest { | |||
# Make sure our system notices the bug (this broke because of a bad push) | |||
! runs_with_newer_hamcrest junit-dep 4.9 | |||
} | |||
|
|||
function TEST_junit_dep_snapshot_plays_nicely_with_later_hamcrest { | |||
runs_with_newer_hamcrest junit-dep LATEST | |||
} | |||
|
|||
function TEST_junit_snapshot_plays_not_nicely_with_later_hamcrest { | |||
! runs_with_newer_hamcrest junit LATEST | |||
} | |||
|
|||
function runs_with_newer_hamcrest { | |||
local artifact_id=$1 | |||
local version=$2 | |||
rm -rf ~/.m2/repository/junit | |||
rm -rf uses_junit | |||
cp -r sample_project_template uses_junit | |||
sed -i '' -e "s/___ARTIFACT_ID___/$artifact_id/" uses_junit/pom.xml | |||
sed -i '' -e "s/___VERSION___/$version/" uses_junit/pom.xml | |||
in_dir uses_junit mvn test | |||
finally rm -rf uses_junit | |||
} | |||
|
|||
### <copied src="https://gist.github.com/1206506"> | |||
function in_dir { | |||
local dir=$1 | |||
shift | |||
if [ ! -e $dir ]; then | |||
echo "$dir does not exist" | |||
return 1 | |||
fi | |||
pushd $dir >/dev/null | |||
"$@" | |||
finally popd >/dev/null | |||
} | |||
|
|||
function finally { | |||
local return_this=$? | |||
"$@" | |||
return $return_this | |||
} | |||
### </copied> | |||
|
|||
source ../run_tests.sh |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
|
|||
<groupId>com.example</groupId> | |||
<artifactId>junit-dependency-test</artifactId> | |||
<version>1.0-SNAPSHOT</version> | |||
|
|||
<properties> | |||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
<version.hamcrest>1.2.1</version.hamcrest> | |||
</properties> | |||
|
|||
<dependencies> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>___ARTIFACT_ID___</artifactId> | |||
<version>___VERSION___</version> | |||
</dependency> | |||
|
|||
<!-- | |||
This dependency must be included *before* junit, because said JAR | |||
contains an old hamcrest-core version. This is problematic at | |||
runtime; see JunitDependencyTest. | |||
If junit-dep has the right contents, the order should not matter. | |||
--> | |||
<dependency> | |||
<groupId>org.hamcrest</groupId> | |||
<artifactId>hamcrest-core</artifactId> | |||
<version>${version.hamcrest}</version> | |||
</dependency> | |||
|
|||
<dependency> | |||
<groupId>org.hamcrest</groupId> | |||
<artifactId>hamcrest-library</artifactId> | |||
<version>${version.hamcrest}</version> | |||
</dependency> | |||
</dependencies> | |||
|
|||
<repositories> | |||
<repository> | |||
<id>Sonatype</id> | |||
<url>https://oss.sonatype.org/content/groups/public</url> | |||
<snapshots><enabled>true</enabled></snapshots> | |||
<releases><enabled>true</enabled></releases> | |||
</repository> | |||
</repositories> | |||
|
|||
<build> | |||
<plugins> | |||
<plugin> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<configuration> | |||
<source>1.5</source> | |||
<target>1.5</target> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
</project> |
33 changes: 33 additions & 0 deletions
33
build/maven/sample_project_template/src/test/java/JunitDependencyTest.java
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
import org.hamcrest.Matchers; | |||
import org.junit.Test; | |||
|
|||
public final class JunitDependencyTest { | |||
/** | |||
* JUnit dependency test. | |||
* | |||
* This class has three dependencies. These can be on the classpath in | |||
* different orders. Of the two orderings below, the first one will cause a | |||
* NoSuchMethodError, while the second one allows the test to pass | |||
* successfully. See the explanation below for more information. | |||
* | |||
* Ordering 1: junit-4.9, hamcrest-core-1.2.1, hamcrest-library-1.2.1. | |||
* Ordering 2: hamcrest-core-1.2.1, junit-4.9, hamcrest-library-1.2.1. | |||
*/ | |||
@Test | |||
public void test() { | |||
/* | |||
* Note that we call Matchers#anyOf(Matcher<T>, Matcher<? super T>). | |||
* This method is provided by hamcrest-library-1.2.1. Said module is | |||
* compiled against hamcrest-core-1.2.1. Matchers#anyOf calls | |||
* AnyOf#anyOf(Matcher<T>, Matcher<? super T>). The latter method is | |||
* provided by hamcrest-core-1.2.1, but *not* by hamcrest-core-1.1. | |||
* | |||
* However, hamcrest-core-1.1 *does* contain a class called AnyOf. Now, | |||
* since junit-4.9 incorporates hamcrest-core-1.1 we must make sure that | |||
* hamcrest-core-1.2.1 is placed *before* junit-4.9 on the classpath. | |||
* Failure to do so will cause the wrong AnyOf class to be used. The | |||
* result is a NoSuchMethodError. | |||
*/ | |||
Matchers.anyOf(Matchers.nullValue(), Matchers.notNullValue()); | |||
} | |||
} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,36 @@ | |||
# See maven/post_maven_tests.sh for an example use | |||
|
|||
SCRIPT_NAME=$0 | |||
TEST_NAME=${1:-ALL} | |||
|
|||
function get_tests() { | |||
if [ $TEST_NAME == "ALL" ]; then | |||
part1=function | |||
part2=TEST_ | |||
grep "$part1 $part2" $SCRIPT_NAME | sed 's/.*\(TEST_[A-Za-z0-9_]*\).*/\1/' | |||
else | |||
echo "TEST_${TEST_NAME}" | |||
fi | |||
} | |||
|
|||
function run_tests() { | |||
local exit_code=0 | |||
|
|||
for t in $(get_tests); do | |||
echo "RUNNING: $t" | |||
if "$t"; then | |||
echo "PASSED: $t" | |||
else | |||
echo "FAILED: $t" | |||
return 1 | |||
fi | |||
done | |||
} | |||
|
|||
if run_tests; then | |||
echo "ALL TESTS PASSED" | |||
exit 0 | |||
else | |||
echo "A TEST FAILED" | |||
exit 1 | |||
fi |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
|
|||
Can't open /Users/saff/git-repos/stems_and_seeds/junit/doc/ReleaseNotes4.9.1.txt: No such file or directory at build/Markdown.pl line 218. | |||
Use of uninitialized value $text in substitution (s///) at build/Markdown.pl line 245. | |||
Use of uninitialized value $text in substitution (s///) at build/Markdown.pl line 246. |
This file was deleted.
Oops, something went wrong.
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