Permalink
Browse files

Fixed issue with bad characters in conversion specs

  • Loading branch information...
djspiewak committed Oct 1, 2011
1 parent 27d44ac commit f17cfc02721a5445fa5fc16b338b57c3382d2d51
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/test/scala/com/codecommit/antixml/ConversionSpecs.scala
@@ -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 {
@@ -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 {
@@ -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)

0 comments on commit f17cfc0

Please sign in to comment.