tests/test_config.rb in wxruby3-0.9.7 vs tests/test_config.rb in wxruby3-0.9.8
- old
+ new
@@ -201,17 +201,20 @@
end
def run_env_var_tests(cfg)
# by default expansion is on
+ # Cirrus CI Linux builds run in privileged container without proper user env
+ has_user = Wx::PLATFORM == 'WXMSW' || ENV['USER']
+
# add a number of entries for env var in new group 'Environment'
cfg['/Environment/HOME'] = '$HOME'
- cfg['Environment'].USER = Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}'
+ cfg['Environment'].USER = Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}' if has_user
cfg['/Environment/PATH'] = '$(PATH)'
assert_equal(ENV['HOME'], cfg.Environment['HOME'])
- assert_equal(ENV[Wx::PLATFORM == 'WXMSW' ? 'USERNAME' : 'USER'], cfg['/Environment/USER'])
+ assert_equal(ENV[Wx::PLATFORM == 'WXMSW' ? 'USERNAME' : 'USER'], cfg['/Environment/USER']) if has_user
assert_equal(ENV['PATH'], cfg.Environment.PATH)
# test escaping
cfg['/Environment/Escaped_HOME'] = '\$HOME'
cfg['/Environment/Escaped_HOME2'] = '\\$HOME'
@@ -223,12 +226,12 @@
cfg['/Environment/NONSENSE'] = '${NonExistingLongNonsenseVariable}'
assert_equal('${NonExistingLongNonsenseVariable}', cfg.Environment['NONSENSE'])
- cfg['/Environment/MULTIPLE'] = "$HOME / #{Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}'}"
+ cfg['/Environment/MULTIPLE'] = "$HOME / #{Wx::PLATFORM == 'WXMSW' ? '%USERNAME%' : '${USER}'}" if has_user
- assert_equal("#{ENV['HOME']} / #{Wx::PLATFORM == 'WXMSW' ? ENV['USERNAME'] : ENV['USER']}", cfg.Environment['MULTIPLE'])
+ assert_equal("#{ENV['HOME']} / #{Wx::PLATFORM == 'WXMSW' ? ENV['USERNAME'] : ENV['USER']}", cfg.Environment['MULTIPLE']) if has_user
# disable env var expansion
cfg.expand_env_vars = false
begin
assert_equal('$HOME', cfg.Environment['HOME'])