Sha256: a5d2cfe3bb295534e7ce4ee11f29e055a2074d7801a70a4813d6ef6e567b1b14

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

# -*- encoding: utf-8 -*-

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

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

5 entries across 5 versions & 3 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 test/test_source_stacked.rb
gettalong-webgen-0.5.8.20090507 test/test_source_stacked.rb
thewoolleyman-webgen-0.5.8.20090419 test/test_source_stacked.rb
webgen-0.5.7 test/test_source_stacked.rb
webgen-0.5.8 test/test_source_stacked.rb