File: test_each.rb

package info (click to toggle)
ruby-pathname2 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 340 kB
  • sloc: ruby: 2,033; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (3)
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
########################################################################
# test_each.rb
#
# Test suite for the Pathname#each method.
########################################################################
require 'pathname2'
require 'test-unit'

class TC_Pathname_Each < Test::Unit::TestCase
  def setup
    @path = Pathname.new("C:/Users/foo/bar")
  end

  test "each basic functionality" do
    assert_respond_to(@path, :each)
    assert_nothing_raised{ @path.each{} }
  end

  test "each returns the expected results" do
    arr = []
    @path.each{ |e| arr << e }
    assert_equal(['C:', 'Users', 'foo', 'bar'], arr)
  end

  def teardown
    @path = nil
  end
end