diff options
author | Liam Devine <dmail00@gmail.com> | 2011-08-24 00:48:16 +0400 |
---|---|---|
committer | Liam Devine <dmail00@gmail.com> | 2011-08-24 00:48:16 +0400 |
commit | f368770a36cca36ba17a8510f20516498145fe05 (patch) | |
tree | 8f503a26a47399aa41195d3553c1165c0d713970 /tests | |
parent | bfc7bb0a598a72447e6a137cc3acf038d2f0e660 (diff) |
* Added debug environment variable support for Codeblocks using gdb
Changes the name from environmentargs to debugenvs
Effects VS flags EnvironmentArgsInherit and EnvironmentArgsDontMerge which become DebugEnvsInherit and DebugEnvsDontMerge respectively.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions/codeblocks/environment_variables.lua | 59 | ||||
-rwxr-xr-x | tests/actions/vstudio/vc2010/test_debugdir.lua | 80 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
3 files changed, 100 insertions, 40 deletions
diff --git a/tests/actions/codeblocks/environment_variables.lua b/tests/actions/codeblocks/environment_variables.lua new file mode 100644 index 0000000..83602ad --- /dev/null +++ b/tests/actions/codeblocks/environment_variables.lua @@ -0,0 +1,59 @@ +-- +-- tests/actions/codeblocks/environment_variables.lua +-- Validate generation of files block in CodeLite C/C++ projects. +-- Copyright (c) 2011 Jason Perkins and the Premake project +-- + + T.codeblocks_environment = { } + local suite = T.codeblocks_environment + local codeblocks = premake.codeblocks + + local old_eol = io.eol + function suite.setup() + _OPTIONS.cc = 'gcc' + old_eol = io.eol + io.eol = '\n' + end + + function suite.teardown() + io.eol = old_eol + end + + function suite.withVar_bufferContainsDebugger() + local MockName = 'MockName' + codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname=MockName} ) + test.string_contains(io.endcapture(), + '\t\t\t<debugger>\n' .. + '\t\t\t\t<remote_debugging target="'..MockName..'">\n' .. + '\t\t\t\t\t<options additional_cmds_before=.- />\n' .. + '\t\t\t\t</remote_debugging>\n' .. + '\t\t\t</debugger>' + ) + end + + function suite.format_SetEnvKeyValuePair() + local env_arg = 'foo=bar' + codeblocks.debugenvs( {debugenvs = {env_arg},language='C',longname='DontCare'} ) + test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '..env_arg..'" />') + end + + function suite.format_mutipleValues_setEnvKeyValuePairEscapeSetEnvKeyValuePair() + local env_arg = { 'foo=bar','baz=qux'} + codeblocks.debugenvs( {debugenvs = env_arg,language='C',longname='DontCare'} ) + test.string_contains(io.endcapture(),'<options additional_cmds_before="set env '.. env_arg[1] + ..'
set env ' .. env_arg[2] .. '" />') + end + + --Why is this an error and not silent? Because I feel if you are setting environment variables + --and they are not getting set in your IDE, than that is a problem which premake should not be + --quite about. + --See codeblocks project generator source for the assumption that gcc has anything to do with this setting. + function suite.withVar_noneGccCompiler_willCallError() + _OPTIONS.cc = 'msc' + local called = 0 + local real_error = error + error = function() called = 1 end + codeblocks.debugenvs( {debugenvs = {'foo=bar'},language='C',longname='foo'} ) + error = real_error + test.isequal(1,called) + end
\ No newline at end of file diff --git a/tests/actions/vstudio/vc2010/test_debugdir.lua b/tests/actions/vstudio/vc2010/test_debugdir.lua index 82d3d14..5651515 100755 --- a/tests/actions/vstudio/vc2010/test_debugdir.lua +++ b/tests/actions/vstudio/vc2010/test_debugdir.lua @@ -54,43 +54,43 @@ ]]
end
- - - T.vs2010_env_args = { } - local vs10_env_args = T.vs2010_env_args - local env_args = premake.vstudio.vc2010.environmentargs - - function vs10_env_args.environmentArgs_notSet_bufferDoesNotContainLocalDebuggerEnvironment() - env_args( {flags={}} ) - test.string_does_not_contain(io.endcapture(),'<LocalDebuggerEnvironment>') - end - - function vs10_env_args.environmentArgs_set_bufferContainsLocalDebuggerEnvironment() - env_args({flags={},environmentargs ={'key=value'}} ) - test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>') - end - - function vs10_env_args.environmentArgs_oneArgformat_openTagKeyValuePairCloseTag() - env_args({flags={},environmentargs ={'key=value'}} ) - test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>') - end - - function vs10_env_args.environmentArgs_twoArgformat_openTagKeyValueNewLineSecondPairCloseTag() - env_args({flags={},environmentargs ={'key=value','foo=bar'}} ) - test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value\nfoo=bar</LocalDebuggerEnvironment>') - end - - function vs10_env_args.environmentArgs_withOutFlagEnvironmentArgsInherit_doesNotContainLocalDebuggerEnvironmentArg() - env_args({flags={},environmentargs ={'key=value'}} ) - test.string_does_not_contain(io.endcapture(),'%$%(LocalDebuggerEnvironment%)') - end - - function vs10_env_args.environmentArgs_withFlagEnvironmentArgsInherit_endsWithNewLineLocalDebuggerEnvironmentFollowedByClosedTag() - env_args({flags={EnvironmentArgsInherit=1},environmentargs ={'key=value'}} ) - test.string_contains(io.endcapture(),'\n%$%(LocalDebuggerEnvironment%)</LocalDebuggerEnvironment>') - end - - function vs10_env_args.environmentArgs_withEnvironmentArgsDontMerge_localDebuggerMergeEnvironmentSetToFalse() - env_args({flags={EnvironmentArgsDontMerge=1},environmentargs ={'key=value'}} ) - test.string_contains(io.endcapture(),'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>') - end +
+
+ T.vs2010_debug_environment = { }
+ local vs10_debug_environment = T.vs2010_debug_environment
+ local vs2010 = premake.vstudio.vc2010
+
+ function vs10_debug_environment.config_noDebugEnvsTable_bufferDoesNotContainLocalDebuggerEnvironment()
+ vs2010.debugenvs( {flags={}} )
+ test.string_does_not_contain(io.endcapture(),'<LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.config_NoneEmtpyDebugEnvTable_bufferContainsLocalDebuggerEnvironment()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.format_listContainsOneEntry_openTagKeyValuePairCloseTag()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.format_listContainsTwoEntries_openTagFirstPairNewLineSecondPairCloseTag()
+ vs2010.debugenvs({flags={},debugenvs ={'key=value','foo=bar'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerEnvironment>key=value\nfoo=bar</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.flags_withOutEnvironmentArgsInherit_doesNotContainLocalDebuggerEnvironmentArg()
+ vs2010.debugenvs({flags={},environmentargs ={'key=value'}} )
+ test.string_does_not_contain(io.endcapture(),'%$%(LocalDebuggerEnvironment%)')
+ end
+
+ function vs10_debug_environment.flags_withDebugEnvsInherit_endsWithNewLineLocalDebuggerEnvironmentFollowedByClosedTag()
+ vs2010.debugenvs({flags={DebugEnvsInherit=1},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'\n%$%(LocalDebuggerEnvironment%)</LocalDebuggerEnvironment>')
+ end
+
+ function vs10_debug_environment.flags_withDebugEnvsDontMerge_localDebuggerMergeEnvironmentSetToFalse()
+ vs2010.debugenvs({flags={DebugEnvsDontMerge=1},debugenvs ={'key=value'}} )
+ test.string_contains(io.endcapture(),'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
+ end
diff --git a/tests/premake4.lua b/tests/premake4.lua index 00ce43f..e24b7eb 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -127,6 +127,7 @@ -- CodeBlocks tests dofile("actions/codeblocks/codeblocks_files.lua") dofile("actions/codeblocks/test_filters.lua") + dofile("actions/codeblocks/environment_variables.lua") -- -- Register a test action |