-
Notifications
You must be signed in to change notification settings - Fork 61
Escape spaces in project path #37
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
Merged
katrinsharp
merged 12 commits into
scalatest:master
from
cstroe:allow-spaces-in-project-path
Jun 13, 2020
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
19ed5eb
Added failing integration test for a project with spaces in the path.
cstroe 2de89ea
Test fails for the correct reason.
cstroe b427515
Actually compile the scala files in our 'spaces in path' project so t…
cstroe 57703a6
Actually run the lift tests and have maven-invoker-plugin verify that…
cstroe c953157
Escape spaces in runpath directory names.
cstroe b3e8661
Merge master from upstream.
cstroe b6c7ed7
Remove verify file for previously removed integration test.
cstroe 10aab00
Merge branch 'master' into allow-spaces-in-project-path
cstroe daff6f0
Indent with spaces.
cstroe a2611cb
Merge branch 'master' into allow-spaces-in-project-path
cstroe 1e9f578
ensure temporary directories exist
cstroe 92a1b39
Clarify error message when output and test output directories don't e…
cstroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
def logsFile = new File(basedir, "build.log") | ||
|
||
if (!logsFile.exists()) { | ||
throw new Exception("Could not find build.log. Searched: " + logsFile) | ||
} | ||
|
||
def testSummaryLines = [] | ||
|
||
logsFile.filterLine { | ||
it ==~ /.*Tests: succeeded [0-9]*, failed [0-9]*, canceled [0-9]*, ignored [0-9]*, pending [0-9]*.*/ | ||
}.each { line -> testSummaryLines << "" + line } | ||
|
||
if (testSummaryLines.size == 0) { | ||
throw new Exception("Could not find scalatest's summary line in build.log") | ||
} else if (testSummaryLines.size > 1) { | ||
throw new Exception("Found more than one scalatest summary line in build.log") | ||
} | ||
|
||
if (testSummaryLines[0].contains("Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0")) { | ||
throw new Exception("No tests were run by scalatest!") | ||
} | ||
|
||
return true |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# spaces in path | ||
|
||
This project is part of scalatest-maven-plugin's suite of integration tests. It is meant to check that scalatest-maven-plugin can run for projects that contain spaces in their file path. |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# A comma or space separated list of goals/phases to execute, may | ||
# specify an empty list to execute the default goal of the IT project | ||
invoker.goals = clean test |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
|
||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>spaces-in-path-it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>spaces-in-path-it</name> | ||
<description>Runs the plugin for a project that contains spaces in the path.</description> | ||
|
||
<parent> | ||
<groupId>maven.scalatest.plugin.its</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../it-parent</relativePath> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
<version>@scala.version@</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>[email protected]@</artifactId> | ||
<version>@scalatest.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>src/main/scala</sourceDirectory> | ||
<testSourceDirectory>src/test/scala</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
<version>@scala.maven.plugin.version@</version> | ||
<configuration> | ||
<recompileMode>incremental</recompileMode> | ||
<scalaVersion>${scala.version}</scalaVersion> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>scala-compile</id> | ||
<phase>process-resources</phase> | ||
<goals> | ||
<goal>add-source</goal> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>scala-test-compile</id> | ||
<phase>process-test-resources</phase> | ||
<goals> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<!-- disable surefire --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<skipTests>true</skipTests> | ||
</configuration> | ||
</plugin> | ||
<!-- enable scalatest --> | ||
<plugin> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>scalatest-maven-plugin</artifactId> | ||
<configuration> | ||
<logForkedProcessCommand>true</logForkedProcessCommand> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scalatest</groupId> | ||
<artifactId>scalatest-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
</project> |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.example | ||
|
||
class App { | ||
def runApp(): String = { | ||
"It ran!" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/it/spaces in path/src/test/scala/org/example/AppTest.scala
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.example | ||
|
||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class AppTest extends FlatSpec with Matchers { | ||
"Our example App" should "run" in { | ||
val app = new App | ||
app.runApp() shouldBe "It ran!" | ||
} | ||
} |
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
def logsFile = new File(basedir, "build.log") | ||
|
||
if (!logsFile.exists()) { | ||
throw new Exception("Could not find build.log. Searched: " + logsFile) | ||
} | ||
|
||
def testSummaryLines = [] | ||
|
||
logsFile.filterLine { | ||
it ==~ /.*Tests: succeeded [0-9]*, failed [0-9]*, canceled [0-9]*, ignored [0-9]*, pending [0-9]*.*/ | ||
}.each { line -> testSummaryLines << "" + line } | ||
|
||
if (testSummaryLines.size == 0) { | ||
throw new Exception("Could not find scalatest's summary line in build.log") | ||
} else if (testSummaryLines.size > 1) { | ||
throw new Exception("Found more than one scalatest summary line in build.log") | ||
} | ||
|
||
if (testSummaryLines[0].contains("Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0")) { | ||
throw new Exception("No tests were run by scalatest!") | ||
} | ||
|
||
return true |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main fix is in this method.