Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Fixed issue with bad characters in conversion specs
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Oct 1, 2011
1 parent 27d44ac commit f17cfc0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/test/scala/com/codecommit/antixml/ConversionSpecs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.scalacheck._
import scala.xml

class ConversionSpecs extends Specification with ScalaCheck {
import Node.CharRegex
import Prop._

"scala.xml explicit conversions" should {
Expand All @@ -58,10 +59,8 @@ class ConversionSpecs extends Specification with ScalaCheck {
validate[Group[Node]](ns2)
}

val BadChars = "([\u0000-\u0008]|[\u000B-\u000C]|[\u000E-\u001F]|[\uD800-\uDFFF]|[\uFFFF])"r

"convert text nodes" in check { str: String =>
if (BadChars.findFirstIn(str).isEmpty) {
if (!CharRegex.unapplySeq(str).isEmpty) {
val node = xml.Text(str)
node.convert mustEqual Text(str)
} else {
Expand All @@ -70,7 +69,7 @@ class ConversionSpecs extends Specification with ScalaCheck {
}

"convert entity references" in check { str: String =>
if (BadChars.findFirstIn(str).isEmpty) {
if (!CharRegex.unapplySeq(str).isEmpty) {
val ref = xml.EntityRef(str)
ref.convert mustEqual EntityRef(str)
(ref: xml.Node).convert mustEqual EntityRef(str)
Expand Down

0 comments on commit f17cfc0

Please sign in to comment.