Sha256: e1a8a5345652de3bb3e6e0a36a0d936af9629783230b1295f4cc080f989c909c

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require 'fileutils'
require 'test/unit'
require 'helpers/consts'
require 'rake/delphi/envvariables'

module DelphiTests

class TestVerInfo < Test::Unit::TestCase
    DPROJ_VERSIONS = { '10' => '2006.bdsproj', '11' => '2007.dproj', \
                       '13' => '2010.dproj', '18' => 'xe5.dproj' }

protected
    def delphi_version
        return Rake::Delphi::EnvVariables.delphi_version
    end

    def prepare_ver_info_file?
        return true
    end

public
    def setup
        @saved_delphi_version = Rake::Delphi::EnvVariables.delphi_version
        ENV['DELPHI_VERSION'] = delphi_version

        template_ext = DPROJ_VERSIONS[delphi_version]
        raise 'DELPHI_VERSION unknown (%s). Please update tests' \
                % delphi_version \
            unless template_ext
        @ver_info_source = PROJECT_PATH.pathmap('%X%s%n.' + template_ext)
        @ver_info_file = PROJECT_PATH.pathmap('%X%s%n') + template_ext.pathmap('%x')

        FileUtils.cp(@ver_info_source, @ver_info_file) if prepare_ver_info_file?
    end

    def teardown
        File.unlink(@ver_info_file) if @ver_info_file && prepare_ver_info_file?
        ENV['DELPHI_VERSION'] = @saved_delphi_version
    end
end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rake-delphi-0.0.9 test/helpers/verinfo.rb
rake-delphi-0.0.8 test/helpers/verinfo.rb
rake-delphi-0.0.7 test/helpers/verinfo.rb
rake-delphi-0.0.6 test/helpers/verinfo.rb
rake-delphi-0.0.5 test/helpers/verinfo.rb