diff --git a/modules/vstudio/tests/_tests.lua b/modules/vstudio/tests/_tests.lua index 7fa711e4..97ccf3cc 100644 --- a/modules/vstudio/tests/_tests.lua +++ b/modules/vstudio/tests/_tests.lua @@ -10,6 +10,7 @@ return { "cs2005/test_build_events.lua", "cs2005/test_common_props.lua", "cs2005/test_compiler_props.lua", + "cs2005/test_no_warn.lua", "cs2005/test_debug_props.lua", "cs2005/test_files.lua", "cs2005/test_icon.lua", diff --git a/modules/vstudio/tests/cs2005/test_no_warn.lua b/modules/vstudio/tests/cs2005/test_no_warn.lua new file mode 100644 index 00000000..e37a4ec3 --- /dev/null +++ b/modules/vstudio/tests/cs2005/test_no_warn.lua @@ -0,0 +1,50 @@ +-- +-- tests/actions/vstudio/cs2005/test_no_warn.lua +-- Validate generation of disabling warnings for Visual Studio 2010 and newer. +-- Copyright (c) 2012-2015 Jason Perkins and the Premake project +-- + + local p = premake + local suite = test.declare("vstudio_cs2005_no_warn") + local dn2005 = p.vstudio.dotnetbase + local project = p.project + + +-- +-- Setup and teardown +-- + + local wks, prj + + function suite.setup() + p.action.set("vs2010") + wks, prj = test.createWorkspace() + end + + local function prepare() + local cfg = test.getconfig(prj, "Debug") + dn2005.NoWarn + (cfg) + end + + +-- +-- If no disableWarnings are specified, nothing should be written. +-- + + function suite.noOutput_onNoDisableWarnings() + prepare() + test.isemptycapture() + end + +-- +-- Handling of disableWarnings +-- + + function suite.output_onDisableWarnings() + disablewarnings { "1018", "1019" } + prepare() + test.capture [[ + 1018;1019 + ]] + end diff --git a/modules/vstudio/vs2005_csproj.lua b/modules/vstudio/vs2005_csproj.lua index 6610d0c2..158b9cce 100644 --- a/modules/vstudio/vs2005_csproj.lua +++ b/modules/vstudio/vs2005_csproj.lua @@ -53,7 +53,8 @@ dotnetbase.propertyGroup, dotnetbase.debugProps, dotnetbase.outputProps, - dotnetbase.compilerProps + dotnetbase.compilerProps, + dotnetbase.NoWarn } end diff --git a/modules/vstudio/vs2005_dotnetbase.lua b/modules/vstudio/vs2005_dotnetbase.lua index 6f36cbf6..033a2563 100644 --- a/modules/vstudio/vs2005_dotnetbase.lua +++ b/modules/vstudio/vs2005_dotnetbase.lua @@ -648,6 +648,14 @@ end + function dotnetbase.NoWarn(cfg) + if #cfg.disablewarnings > 0 then + local warnings = table.concat(cfg.disablewarnings, ";") + _p(2,'%s', warnings) + end + end + + function dotnetbase.targetFrameworkVersion(cfg) local action = p.action.current() local framework = cfg.dotnetframework or action.vstudio.targetFramework diff --git a/modules/vstudio/vs2005_fsproj.lua b/modules/vstudio/vs2005_fsproj.lua index ed659ca2..6c7e8a8d 100644 --- a/modules/vstudio/vs2005_fsproj.lua +++ b/modules/vstudio/vs2005_fsproj.lua @@ -52,6 +52,7 @@ dotnetbase.debugProps, dotnetbase.outputProps, dotnetbase.compilerProps, + dotnetbase.NoWarn, fs2005.tailCalls } end