Project

General

Profile

Feature #8709 ยป globtest.rb

tommorris (Tom Morris), 07/31/2013 01:24 AM

 
1
require "test/unit"
2

    
3
class TestDirGlob < Test::Unit::TestCase
4
  def setup
5
    `mkdir /tmp/rubytest/`
6
    ["001", "002", "003", "999"].each do |num|
7
      `touch /tmp/rubytest/#{num}.txt`
8
    end
9
  end
10
  
11
  def teardown
12
    `rm -rf /tmp/rubytest`
13
  end
14
  
15
  def test_glob
16
    res = Dir.glob("/tmp/rubytest/*.txt")
17
    assert_equal(res.sort, res)
18
  end
19

    
20
  def test_dir_accessor
21
    res = Dir["/tmp/rubytest/*.txt"]
22
    assert_equal(res.sort, res)
23
  end
24
end