summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_source_list.rb
blob: 7c60af3ff8ab6da39ff91c93817b3f94b1aca1c5 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/source_list'
require 'rubygems/test_case'

class TestGemSourceList < Gem::TestCase
  def setup
    super

    @uri = "http://example"
    @source = Gem::Source.new(@uri)

    @sl = Gem::SourceList.new
    @sl << @source
  end

  def test_self_from
    sl = Gem::SourceList.from [@uri]

    assert_equal [Gem::Source.new(@uri)], sl.sources
  end

  def test_Enumerable
    assert_includes Gem::SourceList.ancestors, Enumerable
  end

  def test_append
    sl = Gem::SourceList.new
    sl << @uri
    sl << @uri

    assert_equal sl.to_a.size, 1

    sl.clear
    source = (sl << @uri)

    assert_kind_of Gem::Source, source

    assert_kind_of URI, source.uri
    assert_equal source.uri.to_s, @uri

    assert_equal [source], sl.sources
  end

  def test_clear
    sl = Gem::SourceList.new

    sl << 'http://source.example'

    sl.clear

    assert_empty sl
  end

  def test_replace
    sl = Gem::SourceList.new
    sl.replace [@uri]

    assert_equal [@source], sl.sources
  end

  def test_each
    @sl.each do |x|
      assert_equal @uri, x
    end
  end

  def test_each_source
    @sl.each_source do |x|
      assert_equal @source, x
    end
  end

  def test_empty?
    sl = Gem::SourceList.new

    assert_empty sl

    sl << 'http://source.example'

    refute_empty sl
  end

  def test_equal_to_another_list
    sl2 = Gem::SourceList.new
    sl2 << Gem::Source.new(@uri)

    assert @sl == sl2, "lists not equal"
  end

  def test_equal_to_array
    assert @sl == [@uri], "lists not equal"
  end

  def test_to_a
    assert_equal @sl.to_a, [@uri]
  end

  def test_include_eh
    assert @sl.include?(@uri), "string comparison not working"
    assert @sl.include?(URI.parse(@uri)), "uri comparison not working"
  end

  def test_include_matches_a_source
    assert @sl.include?(@source), "source comparison not working"
    assert @sl.include?(Gem::Source.new(@uri)), "source comparison not working"
  end

  def test_delete
    @sl.delete @uri
    assert_equal @sl.sources, []
  end

  def test_delete_a_source
    @sl.delete Gem::Source.new(@uri)
    assert_equal @sl.sources, []
  end
end
/table> -rwxr-xr-x[-rw-r--r--]bcc32/mkexports.rb2
-rw-r--r--bcc32/setup.mak86
-rw-r--r--bignum.c573
-rwxr-xr-xbin/erb6
-rw-r--r--class.c55
-rw-r--r--common.mk280
-rw-r--r--configure.in536
-rw-r--r--defines.h54
-rw-r--r--dir.c1346
-rw-r--r--distruby.rb59
-rwxr-xr-x[-rw-r--r--]djgpp/configure.bat0
-rw-r--r--dln.c120
-rw-r--r--doc/NEWS-1.8.0 (renamed from doc/NEWS)0
-rw-r--r--enum.c1248
-rw-r--r--enumerator.c450
-rw-r--r--env.h6
-rw-r--r--error.c47
-rw-r--r--eval.c2275
-rw-r--r--ext/.document5
-rw-r--r--ext/Setup1
-rw-r--r--ext/Setup.atheos1
-rw-r--r--ext/Setup.dj1
-rw-r--r--ext/Setup.emx1
-rw-r--r--ext/Setup.nt1
-rw-r--r--ext/Setup.x681
-rw-r--r--ext/Win32API/Win32API.c2
-rw-r--r--ext/Win32API/lib/win32/registry.rb2
-rw-r--r--ext/Win32API/lib/win32/resolv.rb6
-rw-r--r--ext/bigdecimal/bigdecimal.c740
-rw-r--r--ext/bigdecimal/bigdecimal.h12
-rw-r--r--ext/bigdecimal/bigdecimal_en.html9
-rw-r--r--ext/bigdecimal/bigdecimal_ja.html7
-rw-r--r--ext/bigdecimal/extconf.rb8
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb26
-rw-r--r--ext/bigdecimal/lib/bigdecimal/ludcmp.rb9
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb45
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb32
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb31
-rw-r--r--ext/curses/curses.c3
-rw-r--r--ext/curses/extconf.rb2
-rw-r--r--ext/dbm/dbm.c2
-rw-r--r--ext/dbm/extconf.rb60
-rw-r--r--ext/digest/bubblebabble/.cvsignore (renamed from ext/enumerator/.cvsignore)1
-rw-r--r--ext/digest/bubblebabble/bubblebabble.c142
-rw-r--r--ext/digest/bubblebabble/depend3
-rw-r--r--ext/digest/bubblebabble/extconf.rb6
-rw-r--r--ext/digest/defs.h8
-rw-r--r--ext/digest/digest.c694
-rw-r--r--ext/digest/digest.h26
-rw-r--r--ext/digest/digest.txt113
-rw-r--r--ext/digest/digest.txt.ja111
-rw-r--r--ext/digest/extconf.rb4
-rw-r--r--ext/digest/lib/digest.rb50
-rw-r--r--ext/digest/lib/md5.rb17
-rw-r--r--ext/digest/lib/sha1.rb17
-rw-r--r--ext/digest/md5/extconf.rb5
-rw-r--r--ext/digest/md5/md5.c26
-rw-r--r--ext/digest/md5/md5.h9
-rw-r--r--ext/digest/md5/md5init.c23
-rw-r--r--ext/digest/md5/md5ossl.c23
-rw-r--r--ext/digest/md5/md5ossl.h5
-rw-r--r--ext/digest/rmd160/depend2
-rw-r--r--ext/digest/rmd160/extconf.rb7
-rw-r--r--ext/digest/rmd160/rmd160.c9
-rw-r--r--ext/digest/rmd160/rmd160.h16
-rw-r--r--ext/digest/rmd160/rmd160hl.c96
-rw-r--r--ext/digest/rmd160/rmd160init.c26
-rw-r--r--ext/digest/rmd160/rmd160ossl.c43
-rw-r--r--ext/digest/rmd160/rmd160ossl.h4
-rw-r--r--ext/digest/sha1/depend2
-rw-r--r--ext/digest/sha1/extconf.rb7
-rw-r--r--ext/digest/sha1/sha1.c22
-rw-r--r--ext/digest/sha1/sha1.h17
-rw-r--r--ext/digest/sha1/sha1hl.c102
-rw-r--r--ext/digest/sha1/sha1init.c30
-rw-r--r--ext/digest/sha1/sha1ossl.c43
-rw-r--r--ext/digest/sha1/sha1ossl.h7
-rw-r--r--ext/digest/sha2/depend2
-rw-r--r--ext/digest/sha2/extconf.rb6
-rw-r--r--ext/digest/sha2/lib/sha2.rb73
-rw-r--r--ext/digest/sha2/sha2.c26
-rw-r--r--ext/digest/sha2/sha2.h36
-rw-r--r--ext/digest/sha2/sha2hl.c252
-rw-r--r--ext/digest/sha2/sha2init.c23
-rw-r--r--ext/digest/test.sh5
-rw-r--r--ext/dl/dl.c24
-rw-r--r--ext/dl/handle.c4
-rw-r--r--ext/dl/lib/dl/import.rb4
-rw-r--r--ext/dl/lib/dl/win32.rb2
-rw-r--r--ext/dl/mkcallback.rb3
-rw-r--r--ext/dl/ptr.c145
-rw-r--r--ext/dl/sym.c3
-rw-r--r--ext/dl/test/test.rb13
-rw-r--r--ext/enumerator/enumerator.c195
-rw-r--r--ext/enumerator/enumerator.txt102
-rw-r--r--ext/enumerator/extconf.rb2
-rw-r--r--ext/etc/etc.c161
-rw-r--r--ext/etc/extconf.rb16
-rw-r--r--ext/extmk.rb234
-rw-r--r--ext/fcntl/fcntl.c75
-rw-r--r--ext/gdbm/gdbm.c440
-rw-r--r--ext/iconv/charset_alias.rb83
-rw-r--r--ext/iconv/extconf.rb14
-rw-r--r--ext/iconv/iconv.c80
-rw-r--r--ext/io/wait/extconf.rb2
-rw-r--r--ext/io/wait/wait.c4
-rw-r--r--ext/nkf/lib/kconv.rb329
-rw-r--r--ext/nkf/nkf-utf8/config.h36
-rw-r--r--ext/nkf/nkf-utf8/nkf.c3328
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c9337
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h34
-rw-r--r--