File: test_extras.rb

package info (click to toggle)
ruby-openid 2.5.0debian-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,980 kB
  • ctags: 2,219
  • sloc: ruby: 16,737; xml: 219; sh: 24; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (4)
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
require 'test/unit'
require 'openid/extras'

class StartsWithTestCase < Test::Unit::TestCase
    def test_starts_with
        [["anything", ""],
         ["something else", ""],
         ["", ""],
         ["foos", "foo"],
        ].each{|str,target| assert(str.starts_with?(target))}
    end

    def test_not_starts_with
        [["x", "y"],
         ["foos", "ball"],
         ["xx", "xy"],
        ].each{|str,target| assert(!(str.starts_with? target)) }
    end

    def test_ends_with
        [["anything", ""],
         ["something else", " else"],
         ["", ""],
         ["foos", "oos"],
        ].each{|str,target| assert(str.ends_with?(target))}
    end

    def test_not_ends_with
        [["x", "y"],
         ["foos", "ball"],
         ["xx", "xy"],
         ["foosball", "foosbal"],
        ].each{|str,target| assert(!(str.ends_with? target)) }
    end
end