Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe Cannella committed Jan 16, 2019
2 parents ed47e07 + b8235e0 commit ae0a575
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ trait AsciiString
trait Celsius
trait Fahrenheit
trait HtmlHref
trait HtmlImg

object Collection {

Expand Down Expand Up @@ -159,7 +158,6 @@ object Collection {
Validator[Email]("""[a-zA-Z0-9\.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*""")

implicit val validatorEmailSimple: Validator[EmailSimple] = Validator[EmailSimple](""".+@.+\..+""")
implicit val validatorHtmlImg: Validator[HtmlImg] = Validator[HtmlImg]("""<img>.*<\/img>|<img.*[<\/img>|\/>]+""")
implicit val validatorHref: Validator[HtmlHref] = Validator[HtmlHref]("""href=[\"\'](http[s]?:\/\/|\.\/|\/)?\w+(\.\w+)*(\/\w+(\.\w+)?)*(\/|\?\w*=\w*(&\w*=\w*)*)?[\"\']""")
implicit val validatorEmail1: Validator[Email1] = Validator[Email1]("""[_&A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*(\.[A-Za-z]{2,})""")
implicit val validatorFacebook: Validator[Facebook] = Validator[Facebook]("""https:\/\/(www|[a-zA-Z]{2}-[a-zA-Z]{2})\.facebook\.com\/(pages\/[a-zA-Z0-9\.-]+\/[0-9]+|[a-zA-Z0-9\.-]+)[\/]?""")
Expand Down
18 changes: 0 additions & 18 deletions src/test/scala/Validate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,6 @@ class Validate extends FunSuite {
assert(validate[HtmlHref]("""href="bad example"""") == None)
}

test("HtmlImg") {
import com.github.gekomad.regexcollection.Validate.validate
import com.github.gekomad.regexcollection.HtmlImg

assert(
validate[HtmlImg]("""<img alt="bar" height="178" src="https://www.aa.it/cce.jpg" width="316"/>"""") == Some("""<img alt="bar" height="178" src="https://www.aa.it/cce.jpg" width="316"/>"""")
)
assert(validate[HtmlImg]("""xxx"""") == Some("""xxx""""))
assert(validate[HtmlImg]("""xxx"""") == Some("""xxx""""))
assert(validate[HtmlImg]("""<a href="http://www.aaa.it/pxx/""""") == None)
assert(
validate[HtmlImg]("""<img alt="bar" height="178" src="https://www.aa.it/cce.jpg" width="316"/>"""") == Some("""<img alt="bar" height="178" src="https://www.aa.it/cce.jpg" width="316"/>"""")
)
assert(validate[HtmlImg]("""<h2 class="entry-title">"""") == Some("""<h2 class="entry-title">""""))
assert(validate[HtmlImg]("aaaa") == None)

}

test("Email simple") {
import com.github.gekomad.regexcollection.Validate.validate
{ //custom email pattern
Expand Down

0 comments on commit ae0a575

Please sign in to comment.