Sha256: 2c8afc32429c99be9a1fbdbce13e28b83d1cdde39fb4c7b051658c55ac9bdcdc

Contents?: true

Size: 1.62 KB

Versions: 15

Compression:

Stored size: 1.62 KB

Contents

require File.dirname(__FILE__) + '/../system_test_helper'


class RunnersRuleTest < Test::Unit::TestCase

  def setup
    @test_file       = 'test_stuff.c'
    @runner_file     = 'test_stuff_runner.c'
    @test_filepath   = "#{SYSTEM_TEST_ROOT}/simple/test/#{@test_file}"
    @runner_filepath = "#{SYSTEM_TEST_ROOT}/simple/build/tests/runners/#{@runner_file}"

    ENV['CEEDLING_MAIN_PROJECT_FILE'] = File.join(SYSTEM_TEST_ROOT, 'project_simple.yml')

    ceedling_execute('directories', 'clobber')    
  end

  def teardown
  end


  should "generate a test runner from a test source header file and regenerate when its dependent source changes" do
    rake_exec_matcher = /^\*\* Execute.+#{Regexp.escape(@runner_file)}$/
    
    # verify clobber did its job
    assert_equal(false, File.exists?(@runner_filepath))
    
    # give rake a task to generate a test runner file & verify its presence
    ceedling_execute(@runner_filepath)
    assert_equal(true, File.exists?(@runner_filepath), 'test runner file not created')
    
    # verify executing rule again will not regenerate runner
    output = ceedling_execute_dry_run(@runner_filepath)
    assert_no_match(rake_exec_matcher, output, 'test runner file should not be slated for generation')
    
    # wait a spell to update file timestamp, ensuring time change is recognizable
    sleep(1)
    FileUtils.touch(@test_filepath)

    # verify executing rule again will regenerate runner
    output = ceedling_execute_dry_run(@runner_filepath)
    assert_match(rake_exec_matcher, output, 'test runner file should be slated for generation')    
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ceedling-0.19.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.18.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.17.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.16.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.6 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.5 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.4 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.3 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.2 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.1 test_graveyard/system/rule_runners_test.rb
ceedling-0.15.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.13.0 test_graveyard/system/rule_runners_test.rb
ceedling-0.13.0.rc1 test_graveyard/system/rule_runners_test.rb
ceedling-0.0.2 new_project_template/vendor/ceedling/test/system/rule_runners_test.rb
ceedling-0.0.1 new_project_template/vendor/ceedling/test/system/rule_runners_test.rb