Sha256: 17a2540d8132195fd6f0758658460c4a7fcbfca927ec012d365029b0384318f6

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'test/unit'
require 'helper'
require 'webgen/source/stacked'

class TestSourceFileSystemStacked < Test::Unit::TestCase

  class TestSource
    def initialize(paths); @paths = paths; end
    def paths; Set.new(@paths); end
  end

  def test_initialize
    source = Webgen::Source::Stacked.new
    assert_equal([], source.stack)
    source = Webgen::Source::Stacked.new('/dir' => 6)
    assert_equal([['/dir', 6]], source.stack)
  end

  def test_add
    source = Webgen::Source::Stacked.new
    assert_raise(RuntimeError) { source.add(['dir', 6])}
    source.add('/temp' => :source)
    assert_equal([['/temp', :source]], source.stack)
  end

  def test_paths
    source = Webgen::Source::Stacked.new
    source.add('/' => TestSource.new([Webgen::Path.new('/hallo/dir'), Webgen::Path.new('/other')]))
    source.add('/hallo' => TestSource.new([Webgen::Path.new('/dir'), Webgen::Path.new('/other')]))
    assert_equal(Set.new([Webgen::Path.new('/hallo/dir'), Webgen::Path.new('/other'),
                          Webgen::Path.new('/hallo/other')]), source.paths)
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.4.20080929 test/test_source_stacked.rb
gettalong-webgen-0.5.5.20081001 test/test_source_stacked.rb
webgen-0.5.0 test/test_source_stacked.rb
webgen-0.5.1 test/test_source_stacked.rb
webgen-0.5.2 test/test_source_stacked.rb
webgen-0.5.4 test/test_source_stacked.rb
webgen-0.5.3 test/test_source_stacked.rb
webgen-0.5.5 test/test_source_stacked.rb