-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
adc545c
commit 97b5771
Showing
1 changed file
with
46 additions
and
1 deletion.
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,6 +1,51 @@ | ||
[](https://travis-ci.org/stringbean/scala-xml-compare) | ||
[](https://www.codacy.com/app/stringbean/scala-xml-compare) | ||
[](https://codecov.io/gh/stringbean/scala-xml-compare) | ||
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.11%22) | ||
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.12%22) | ||
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22software.purpledragon%22%20a%3A%22xml-compare_2.13.0-M5%22) | ||
|
||
# XML Comparison Utils for Scala | ||
# XML Comparison Utils for Scala | ||
|
||
`scala-xml-compare` is a small Scala library for comparing XML documents. | ||
|
||
## Quickstart | ||
|
||
Add the following to your `build.sbt`: | ||
|
||
```scala | ||
libraryDependencies += "purpledragon.software" %% "scala-xml" % "<version>" | ||
``` | ||
|
||
You can then compare XML using: | ||
|
||
```scala | ||
val doc1 = <person><name>John Smith</name></person> | ||
val doc2 = <person><name>Peter Smith</name></person> | ||
|
||
val result = XmlCompare.compare(doc1, doc2) | ||
// result1 = XmlDiffers("different text", "John Smith", "Peter Smith") | ||
``` | ||
|
||
### Scalatest | ||
|
||
A companion library is provided for testing XML in Scalatest: | ||
|
||
```scala | ||
libraryDependencies += "purpledragon.software" %% "scala-scalatest" % "<version>" % Test | ||
``` | ||
|
||
This then enables the `beXml` matcher: | ||
|
||
```scala | ||
val doc = <person><name>John Smith</name></person> | ||
doc should beXml(<person><name>John Smith</name></person>) | ||
``` | ||
|
||
### specs2 | ||
|
||
Similarly a companion library for specs2 is provided: | ||
|
||
```scala | ||
libraryDependencies += "purpledragon.software" %% "scala-specs2" % "<version>" % Test | ||
``` |