Class PathListTest
In: lib/path_list.rb
Parent: Test::Unit::TestCase

Methods

Included Modules

YamlExtension::Assertions

Public Instance methods

[Source]

# File lib/path_list.rb, line 500
    def setup
      @r = TempPath.new
      @r.mkpath
      @l = PathList[]
      @args = []
      @mo = lambda { |*a| @args << a }
      %w[ foo barbar bazfoo foo/a foo/b bu bi ].each do |x|
        (@r/x).mkpath
        @l << @r/x
      end
      @l2 = PathList[@r/'(f?o)', @r/'b(a*)', @r/'fo,',
                     @r/'f.o', @r/'**/({a,b})']
      @l3 = PathList[@r/'ba{rbar,zfoo}']
      @l4 = PathList[@r/'(b{a{rbar,zfoo},u,i})']
    end

[Source]

# File lib/path_list.rb, line 516
    def test_each
      @l.each(&@mo)
      @l2.each(&@mo)
      @l3.each(&@mo)
      @l4.each(&@mo)
      assert_equal([
        [@r/'foo'], [@r/'barbar'], [@r/'bazfoo'], [@r/'foo/a'], [@r/'foo/b'],
        [@r/'bu'], [@r/'bi'],

        [@r/'foo', 'foo'], [@r/'barbar', 'arbar'], [@r/'bazfoo', 'azfoo'],
        [@r/'fo,'], [@r/'f.o'], [@r/'foo/a', 'a'], [@r/'foo/b', 'b'],

        [@r/'barbar'], [@r/'bazfoo'],

        [@r/'barbar', 'barbar'], [@r/'bazfoo', 'bazfoo'], [@r/'bu', 'bu'],
        [@r/'bi', 'bi']
      ], @args)
    end

[Source]

# File lib/path_list.rb, line 535
    def test_pathlist
      ls = __FILE__.to_path.dirname + '*.rb'
      assert_yaml_load "!filelist #{ls}", PathList, PathList[ls]
      assert_yaml_dump @val.to_a, /.*/     
      assert_yaml_dump @val, @str
    end

[Validate]