Sha256: 2601c0b76cb015efddb164942f8463e02f93f424dbd7b960ee0aa0f2367fa9f4

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

#
# testing ruote
#
# Wed Aug  5 08:35:38 JST 2009
#

require File.join(File.dirname(__FILE__), 'base')


class FtLoadDefsTest < Test::Unit::TestCase
  include FunctionalBase

  def test_load_definition

    pdef = %{
Ruote.process_definition :name => 'test' do
  sequence do
    echo 'a'
    echo 'b'
  end
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    assert_equal(
      [ 'define', { 'name' => 'test' }, [
        ['sequence', {}, [
          ['echo', { 'a' => nil }, [] ],
          ['echo', { 'b' => nil}, [] ] ] ] ] ],
      @engine.load_definition(fn))
  end

  def test_load_definition_with_absolute_path

    pdef = %{
Ruote.process_definition do
  echo 'a'
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    fn = File.expand_path(fn)

    assert_equal(
      [ 'define', {}, [ [ 'echo', { 'a' => nil }, [] ] ] ],
      @engine.load_definition(fn))
  end

  def test_load_illegal_definition

    pdef = %{
Ruote.process_definition :name => 'test' do
  exit
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    assert_raise Ruote::Reader::Error do
      @engine.load_definition(fn)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-maestrodev-2.2.1 test/functional/ft_23_load_defs.rb