Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
added more url validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Jiang committed Feb 4, 2011
1 parent 13e5158 commit 670be5c
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,54 @@ tests:
text: "http://sports.yahoo.com/nfl/news;_ylt=Aom0;ylu=XyZ?slug=ap-superbowlnotebook"
expected: true

- description: "Valid url: ipv4"
text: "http://192.168.0.1/index.html?src=asdf"
expected: true

- description: "Valid url: ipv6"
text: "http://[3ffe:1900:4545:3:200:f8ff:fe21:67cf]:80/index.html"
expected: true

- description: "Valid url: sub delims and question marks"
text: "http://example.com?foo=$bar.;baz?BAZ&c=d-#top/?stories+"
expected: true

- description: "Valid unicode url: unicode domain"
text: "http://☃.net/"
expected: true

- description: "Invalid url: invalid domain underscore"
- description: "Invalid url: invalid scheme"
text: "ftp://www.example.com/"
expected: false

- description: "Invalid url: invalid userinfo characters"
text: "https://user:pass[word]@www.example.com/"
expected: false

- description: "Invalid url: underscore in domain"
text: "http://domain-dash_2314352345_dfasd.foo-cow_4352.com"
expected: false

- description: "Invalid url: invalid domain beginning dash"
- description: "Invalid url: domain beginning dash"
text: "http://www.-domain4352.com/"
expected: false

- description: "Invalid url: invalid domain trailing dash"
- description: "Invalid url: domain trailing dash"
text: "http://www.domain4352-.com/"
expected: false

- description: "Invalid url: invalid unicode domain trailing dash"
- description: "Invalid url: unicode domain trailing dash"
text: "http://☃-.net/"
expected: false

- description: "Invalid url: improperly encoded unicode domain"
text: "http://%e2%98%83.net/"
expected: false

- description: "Invalid url: invalid IP"
text: "http://256.1.2.3/"
expected: false

- description: "Invalid url: invalid char in path"
text: "http://en.wikipedia.org/wiki/\"#Punctuation"
expected: false
Expand Down

0 comments on commit 670be5c

Please sign in to comment.