File: test_urls.rb

package info (click to toggle)
ruby-twitter-text 1.10.0%2Bgem-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 372 kB
  • ctags: 207
  • sloc: ruby: 2,928; makefile: 2
file content (83 lines) | stat: -rw-r--r-- 2,661 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# encoding: utf-8

module TestUrls
  VALID = [
    "http://google.com",
    "http://foobar.com/#",
    "http://google.com/#foo",
    "http://google.com/#search?q=iphone%20-filter%3Alinks",
    "http://twitter.com/#search?q=iphone%20-filter%3Alinks",
    "http://somedomain.com/index.php?path=/abc/def/",
    "http://www.boingboing.net/2007/02/14/katamari_damacy_phon.html",
    "http://somehost.com:3000",
    "http://xo.com/~matthew+%-x",
    "http://en.wikipedia.org/wiki/Primer_(film)",
    "http://www.ams.org/bookstore-getitem/item=mbk-59",
    "http://chilp.it/?77e8fd",
    "http://tell.me/why",
    "http://longtlds.info",
    "http://✪df.ws/ejp",
    "http://日本.com",
    "http://search.twitter.com/search?q=avro&lang=en",
    "http://mrs.domain-dash.biz",
    "http://x.com/has/one/char/domain",
    "http://t.co/nwcLTFF",
    "http://sub_domain-dash.twitter.com",
    "http://a.b.cd",
    "http://a_b.c-d.com",
    "http://a-b.b.com",
    "http://twitter-dash.com",
    "http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx",
    "www.foobar.com",
    "WWW.FOOBAR.COM",
    "www.foobar.co.jp",
    "http://t.co",
    "t.co/nwcLTFF",
    "http://foobar.みんな",
    "http://foobar.中国",
    "http://foobar.پاکستان"
  ] unless defined?(TestUrls::VALID)

  INVALID = [
    "http://no-tld",
    "http://tld-too-short.x",
    "http://-doman_dash.com",
    "http://_leadingunderscore.twitter.com",
    "http://trailingunderscore_.twitter.com",
    "http://-leadingdash.twitter.com",
    "http://trailingdash-.twitter.com",
    "http://-leadingdash.com",
    "http://trailingdash-.com",
    "http://no_underscores.com",
    "http://test.c_o_m",
    "http://test.c-o-m",
    "http://twitt#{[0x202A].pack('U')}er.com",
    "http://twitt#{[0x202B].pack('U')}er.com",
    "http://twitt#{[0x202C].pack('U')}er.com",
    "http://twitt#{[0x202D].pack('U')}er.com",
    "http://twitt#{[0x202E].pack('U')}er.com"
  ] unless defined?(TestUrls::INVALID)

  TCO = [
    "http://t.co/P53cv5yO!",
    "http://t.co/fQJmiPGg***",
    "http://t.co/pbY2NfTZ's",
    "http://t.co/2vYHpAc5;",
    "http://t.co/ulYGBYSo:",
    "http://t.co/GeT4bSiw=win",
    "http://t.co/8MkmHU0k+fun",
    "http://t.co/TKLp64dY.yes,",
    "http://t.co/8vuO27cI$$",
    "http://t.co/rPYTvdA8/",
    "http://t.co/WvtMw5ku%",
    "http://t.co/8t7G3ddS#",
    "http://t.co/nfHNJDV2/#!",
    "http://t.co/gK6NOXHs[good]",
    "http://t.co/dMrT0o1Y]bad",
    "http://t.co/FNkPfmii-",
    "http://t.co/sMgS3pjI_oh",
    "http://t.co/F8Dq3Plb~",
    "http://t.co/ivvH58vC&help",
    "http://t.co/iUBL15zD|NZ5KYLQ8"
  ] unless defined?(TestUrls::TCO)
end