�
�"Kb� � � � d Z ddlmZ n# e$ r ddlmZ Y nw xY wddlZddlmZ G d� dej � � Ze dk r ej
� � dS dS )z(Unit tests for the MSVSSettings.py file.� )�StringIONc �J � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� ZdS )�TestSequenceFunctionsc �, � t � � | _ d S )N)r �stderr��selfs �7/usr/lib/python3/dist-packages/gyp/MSVSSettings_test.py�setUpzTestSequenceFunctions.setUp s � ��*�*�D�K�K�K� c �
� | j � d� � | j � � � � d� � }d� |D � � }| � t |� � t |� � � � dS )z-Compares recorded lines to expected warnings.r �
c � � g | ]}|�|��S � r )�.0�lines r
�
<listcomp>z;TestSequenceFunctions._ExpectedWarnings.<locals>.<listcomp> s � �
.�
.�
.�t��
.�d�
.�
.�
.r N)r �seek�read�split�assertEqual�sorted)r �expected�actuals r
�_ExpectedWarningsz'TestSequenceFunctions._ExpectedWarnings sv � ��K���Q����
�[�
�
�
�
�
%�
%�d�
+�
+�F�
.�
.�v�
.�
.�
.�F����V�H�%�%�v�f�~�~�6�6�6�6�6r c �z � t j i i i i i i i i d�| j � � | � ddg� � dS )z,Tests that only MSVS tool names are allowed.)�VCCLCompilerTool�VCLinkerTool�
VCMIDLTool�foo�VCResourceCompilerTool�VCLibrarianTool�VCManifestTool� ClCompilezWarning: unrecognized tool fooz$Warning: unrecognized tool ClCompileN��MSVSSettings�ValidateMSVSSettingsr r r s r
�#testValidateMSVSSettings_tool_namesz9TestSequenceFunctions.testValidateMSVSSettings_tool_names so � ��%�����#%���� � �
�� � � � ���(�.�0� 1� 1� 1� 1� 1r c � � t j i dd�dddg�dd�dd�d d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�i dd�dd�d d�d!d�d"d#�d$d�d%d�d&d�d'd�d(d�d)d�d*d�d+d,�d-d,�d.d�d/d�d0d��i d1d�d2d�d3d�d4d�d5d�d6d�d7d�d8d�d9d�d:d�d;d�d<d�d=d�d>d�d?d�d@d�dAd��ddddddddddddd#dB�
�i dCd,�dDdE�dFd�dGd,�ddH�dId,�dJd�dKd�dLd,�dMdH�dNd�dOd�dPd�dQd�dRd,�dSd�dTd�i dUd,�dVd�dWd�dXdH�d$d�dYd�dZd,�d[d�d\d�d]d�d^d�d_dH�d`dH�dad�dbd,�dcd�ddd��i ded�dfd�dgd�dhd�did�djd�dkd�dld�dmd�dnd�dod�dpdH�dqd�drd�dsd�dtd�dud��i dvd�dwd�dxd�dyd�dzd�d{d�d|d�d}d�d~d�ddH�d�dH�d�d�d�d�d�d�d�d�d�d�d�d��ddddd�dddddHd��
�i dd�ddH�d�dH�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d0d�d�d�d�d�d#dHdddddddddddd��
�dHdd�dd#ddHdddd��
d,ddHddHdd,dddddd��i d�d,�ddH�d�dH�d�d�d�d�d�d�d�dH�d�d�d�d�d�d�d�d�d�d�d�d�d�d��d�d�d�d�d�d�d�di�d��| j � � | � g d��� � d�S )�z%Tests that for invalid MSVS settings.�AdditionalIncludeDirectories�folder1;folder2�AdditionalOptions�string1�string2�AdditionalUsingDirectories�AssemblerListingLocation�a_file_name�AssemblerOutput�0�BasicRuntimeChecks�5�BrowseInformation�fdkslj�BrowseInformationFile�BufferSecurityCheck�true�CallingConventionz-1� CompileAs�1�DebugInformationFormat�2�DefaultCharIsUnsigned�Detect64BitPortabilityProblems�DisableLanguageExtensions�DisableSpecificWarnings�string1;string2�EnableEnhancedInstructionSet�EnableFiberSafeOptimizations�EnableFunctionLevelLinking�EnableIntrinsicFunctions�
EnablePREfast�
Enableprefast�bogus�ErrorReporting�ExceptionHandling�ExpandAttributedSource�FavorSizeOrSpeed�FloatingPointExceptions�FloatingPointModel�ForceConformanceInForLoopScope�ForcedIncludeFiles�file1;file2�ForcedUsingFiles�GeneratePreprocessedFile�GenerateXMLDocumentationFiles�IgnoreStandardIncludePath�InlineFunctionExpansion�KeepComments�MinimalRebuild�
ObjectFile�OmitDefaultLibName�OmitFramePointers�OpenMP�Optimization�PrecompiledHeaderFile�PrecompiledHeaderThrough�PreprocessorDefinitions�ProgramDataBaseFileName�RuntimeLibrary�RuntimeTypeInfo�ShowIncludes�SmallerTypeCheck�
StringPooling)
�StructMemberAlignment�SuppressStartupBanner�TreatWChar_tAsBuiltInType�"UndefineAllPreprocessorDefinitions�UndefinePreprocessorDefinitions�UseFullPaths�UsePrecompiledHeader�UseUnicodeResponseFiles�WarnAsError�WarningLevel�WholeProgramOptimization�XMLDocumentationFileName�ZZXYZ�AdditionalDependencies�AdditionalDependencies_excluded�file3�AdditionalLibraryDirectories�AdditionalManifestDependencies� a string1�AddModuleNamesToAssembly�AllowIsolation�
AssemblyDebug�AssemblyLinkResource�BaseAddress�CLRImageType�CLRThreadAttribute�CLRUnmanagedCodeCheck�DataExecutionPrevention�
DelayLoadDLLs� DelaySign�Driver�EmbedManagedResourceFile�EnableCOMDATFolding� EnableUAC�EntryPointSymbol�FixedBaseAddress�ForceSymbolReferences�
FunctionOrder�GenerateDebugInformation�GenerateManifest�GenerateMapFile�HeapCommitSize�HeapReserveSize�IgnoreAllDefaultLibraries�IgnoreDefaultLibraryNames�IgnoreEmbeddedIDL�IgnoreImportLibrary�
ImportLibrary�KeyContainer�KeyFile�LargeAddressAware�LinkIncremental�LinkLibraryDependencies�LinkTimeCodeGeneration�ManifestFile�
MapExports�MapFileName�MergedIDLBaseFileName�
MergeSections�MidlCommandFile�ModuleDefinitionFile�OptimizeForWindows98�OptimizeReferences�
OutputFile�PerUserRedirection�Profile�ProfileGuidedDatabase�ProgramDatabaseFile�RandomizedBaseAddress�RegisterOutput�ResourceOnlyDLL�SetChecksum�ShowProgress�StackCommitSize�StackReserveSize�StripPrivateSymbols� SubSystem�SupportUnloadOfDelayLoadedDLLrk �
SwapRunFromCD�SwapRunFromNet�33�
�
TargetMachine�TerminalServerAware�TurnOffAssemblyGeneration�TypeLibraryFile�TypeLibraryResourceID�UACExecutionLevel�UACUIAccess�UseLibraryDependencyInputsrq �Version�CPreprocessOptions�DefaultCharType�DLLDataFileName�EnableErrorChecks�ErrorCheckAllocations�ErrorCheckBounds�ErrorCheckEnumRange�ErrorCheckRefPointers�ErrorCheckStubData�GenerateStublessProxies�GenerateTypeLibrary�HeaderFileName�InterfaceIdentifierFileName�MkTypLibCompatible)
�notgood�OutputDirectoryrc �
ProxyFileName�RedirectOutputAndErrorsrj rk �TargetEnvironment�TypeLibraryNamern �ValidateParametersrr rs �1003)
r, r* �CulturerX �notgood2rc �ResourceOutputFileNamer� rk rn )rw rz r, �ExportNamedFunctionsr� r� �IgnoreSpecificDefaultLibrariesr� r� r� rk rq �AdditionalManifestFiles�AssemblyIdentity�ComponentFileName�DependencyInformationFile�GenerateCatalogFiles�InputResourceManifests�ManifestResourceFile�OutputManifestFile�RegistrarScriptFile�ReplacementsFiler� �UpdateFileHashes�truel�UpdateFileHashesSearchPath�UseFAT32Workaroundrq �
VerboseOutput)r r r r! r" |