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

Scala 2.10 support #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 20 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<forge-project-id>scalamd</forge-project-id>
<release-altGitURL>scm:git:ssh://[email protected]:chirino/scalamd.git</release-altGitURL>

<scala-version>2.8.1</scala-version>
<maven-scala-plugin-version>2.15.0</maven-scala-plugin-version>
<scala-version>2.10.0-M7</scala-version>
<scala-maven-plugin-version>3.1.0</scala-maven-plugin-version>
<maven-surefire-plugin-version>2.4.3</maven-surefire-plugin-version>
<bundle-plugin-version>2.3.4</bundle-plugin-version>

Expand Down Expand Up @@ -80,9 +80,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-tools.testing</groupId>
<artifactId>specs_2.8.1</artifactId>
<version>1.6.6</version>
<groupId>org.specs2</groupId>
<artifactId>specs2_2.10.0-M7</artifactId>
<version>1.12.1.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -126,9 +126,9 @@

<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>${maven-scala-plugin-version}</version>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
<executions>
<execution>
<goals>
Expand All @@ -151,18 +151,18 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>

<configuration>
<!-- we must turn off the use of system class loader so our tests can find stuff - otherwise ScalaSupport compiler can't find stuff -->
<useSystemClassLoader>false</useSystemClassLoader>
<!--forkMode>pertest</forkMode-->
<childDelegation>false</childDelegation>
<useFile>true</useFile>
<failIfNoTests>false</failIfNoTests>
</configuration>
<groupId>com.mmakowski</groupId>
<artifactId>maven-specs2-plugin</artifactId>
<version>0.4.0-RC1</version>
<executions>
<execution>
<id>test-specs2</id>
<phase>test</phase>
<goals>
<goal>run-specs</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand Down
22 changes: 10 additions & 12 deletions src/test/scala/test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,34 @@
*/
package org.fusesource.scalamd.test

import org.specs.runner.JUnit4
import org.specs.Specification
import java.io.File
import org.fusesource.scalamd.Markdown
import org.apache.commons.io.FileUtils
import org.apache.commons.lang.StringUtils
import org.specs.matcher.Matcher
import org.specs2.mutable._
import org.specs2.matcher.Expectable
import org.specs2.matcher.Matcher

class SpecsTest extends JUnit4(MarkdownSpec)

object MarkdownSpec extends Specification {
object MarkdownSpec extends SpecificationWithJUnit {

val beFine = new Matcher[String] {
def apply(name: => String) = {
def apply[S <: String](s: Expectable[S]) = {
val name = s.value
val textFile = new File(this.getClass.getResource("/" + name + ".text").toURI)
val htmlFile = new File(this.getClass.getResource("/" + name + ".html").toURI)
val text = Markdown(FileUtils.readFileToString(textFile, "UTF-8")).trim
// println("[%s]".format(text))
val html = FileUtils.readFileToString(htmlFile, "UTF-8").trim
val diffIndex = StringUtils.indexOfDifference(text, html)
val diff = StringUtils.difference(text, html)
(diffIndex == -1,
result(diffIndex == -1,
"\"" + name + "\" is fine",
"\"" + name + "\" fails at " + diffIndex + ": " + StringUtils.abbreviate(diff, 32))
"\"" + name + "\" fails at " + diffIndex + ": " + StringUtils.abbreviate(diff, 32),
s)
}
}

def process = addToSusVerb("process")

"MarkdownProcessor" should process {
"MarkdownProcessor" should {
"Images" in {
"Images" must beFine
}
Expand Down