Sha256: 26a729f3247f591cb98b2b99162b317d3b6930815760bae450a957c3f1e9327d

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require File.join(File.dirname(__FILE__), "test_helper")

class ClassGeneratorTest < Test::Unit::TestCase
  include SproutTestCase

  context "a new class generator" do

    setup do
      @temp = File.join(fixtures, 'generators', 'tmp')
      FileUtils.mkdir_p @temp
      @generator = AS3::ClassGenerator.new
      @generator.path = @temp
      @generator.logger = StringIO.new
    end

    teardown do
      remove_file @temp
    end

    should "work with a simple class" do
      @generator.input = 'utils.MathUtil'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end

    should "work with no package" do
      @generator.input = 'MathUtil'
      @generator.execute
      assert_file File.join(@temp, 'src', 'MathUtil.as')
    end

    should "work with directory instead of dots" do
      @generator.input = 'src/utils/MathUtil.as'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end

    should "work with directory but no source" do
      @generator.input = 'utils/MathUtil.as'
      @generator.execute
      assert_file File.join(@temp, 'src', 'utils', 'MathUtil.as')
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
as3-1.0.4.pre test/unit/class_generator_test.rb
as3-1.0.3.pre test/unit/class_generator_test.rb
as3-1.0.1.pre test/unit/class_generator_test.rb
as3-1.0.0.pre test/unit/class_generator_test.rb