This repository has been archived by the owner on May 15, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
target/ | ||
project/boot/ | ||
lib_managed/ |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import sbt._ | ||
|
||
class Project(info: ProjectInfo) extends DefaultProject(info) { | ||
val scalaTools = "scalaTools" at "http://scala-tools.org/repo/" | ||
val specs = "org.scala-tools.testing" %% "specs" % "1.6.7.1" % "test" | ||
|
||
override def includeTest(s: String) = s endsWith "Specs" | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.codecommit.antixml | ||
|
||
import org.specs._ | ||
|
||
object XMLSpecs extends Specification { | ||
import XML._ | ||
|
||
"xml parsing" should { | ||
"parse an empty elem" in { | ||
fromString("<test/>") mustEqual NodeSeq(elem("test")) | ||
} | ||
|
||
"parse an elem with text" in { | ||
fromString("<test>This is a test</test>") mustEqual NodeSeq(elem("test", Text("This is a test"))) | ||
} | ||
|
||
"parse an elem with sub-elements" in { | ||
fromString("<test><sub1/><sub2/></test>") mustEqual NodeSeq(elem("test", elem("sub1"), elem("sub2"))) | ||
} | ||
|
||
"parse a deeply-nested structure" in { | ||
fromString("<test><sub1><subsub1><subsubsub1/><subsubsub2/></subsub1></sub1><sub2/><sub3><subsub1/></sub3></test>") mustEqual NodeSeq(elem("test", elem("sub1", elem("subsub1", elem("subsubsub1"), elem("subsubsub2"))), elem("sub2"), elem("sub3", elem("subsub1")))) | ||
} | ||
|
||
"parse mixed content" in { | ||
fromString("<test>This is a <inner-test/> of great glory!</test>") mustEqual NodeSeq(elem("test", Text("This is a "), elem("inner-test"), Text(" of great glory!"))) | ||
} | ||
|
||
"preserve whitespace" in { | ||
fromString("<test>\n \n\t\n</test>") mustEqual NodeSeq(elem("test", Text("\n \n\t\n"))) | ||
} | ||
} | ||
|
||
def elem(name: String, children: Node*) = Elem(None, name, Map(), NodeSeq(children: _*)) | ||
} |