Sha256: 50c3b7e33dfaa48aff946bbf0ea6329372fdc19c4a2294ef7cd12a7217caef7d

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

require 'rake'
require 'minitest/autorun'
require 'rake/delphi/envvariables'
require 'rake/helpers/unittest'

class TestEnvVariables < MiniTest::Unit::TestCase

    def setup
        ENV['BDS_PLATFORM'] = 'BDS platform'
        ENV['BDS_PLATFORM_CASE'] = 'BDS platform case'
    end

    def test_expands
        env_vars = Rake::Delphi::EnvVariables.new(nil, 'c:/delphi directory/')
        assert_equal('c:/delphi directory', env_vars['BDS'])
        assert_equal('c:/delphi directory/Lib', env_vars['BDSLIB'])
        assert_equal('Platform: BDS platform', env_vars.expand('Platform: $(BDS_PLATFORM)'))
        assert_equal('Platform: BDS platform case', env_vars.expand('Platform: $(bds_platform_case)'))

        assert_equal('Env: $(BDS_NON_EXISTANT)', env_vars.expand('Env: $(BDS_NON_EXISTANT)'))

        env_vars['BDS_PLATFORM_CASE_2'] = 'BDS Platform Case 2'
        # be sure there is no BDS_Platform_Case_2 defined
        refute_equal('BDS Platform Case 2', env_vars['BDS_Platform_Case_2'])
        # also freeze string (ENV vars are frozen strings)
        assert_equal('Platform: BDS Platform Case 2', env_vars.expand('Platform: $(BDS_Platform_Case_2)'.freeze))
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rake-delphi-0.0.34 test/test-envvariables.rb
rake-delphi-0.0.33 test/test-envvariables.rb
rake-delphi-0.0.32 test/test-envvariables.rb