-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Ensure that types referenced by PowerShellStandard are present #10634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TravisEz13
merged 10 commits into
PowerShell:master
from
JamesWTruher:StandardLibraryTests
Feb 3, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bb98fa1
Ensure that types referenced by PowerShellStandard are present
JamesWTruher a98ef18
Remove extra new lines
daxian-dbw 25e2772
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher bfe89b5
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher 2fc392b
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher 12a95ec
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher 50275b9
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher d9e3bf6
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher 869e3ae
Update test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
JamesWTruher 823a280
Fix typo in test
JamesWTruher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
test/powershell/engine/Basic/StandardLibraryTypes.Tests.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
JamesWTruher marked this conversation as resolved.
Outdated
JamesWTruher marked this conversation as resolved.
Outdated
JamesWTruher marked this conversation as resolved.
Outdated
JamesWTruher marked this conversation as resolved.
Outdated
|
||
| # Licensed under the MIT License. | ||
|
|
||
| # This is a simple type check to validate that types in PowerShellStandard are present in System.Management.Automation.dll | ||
| # It does not check member presence and info, just the properties of the type | ||
| Describe "Types referenced by PowerShell Standard should not be missing" -Tags "CI" { | ||
| BeforeAll { | ||
| $assets = [System.IO.Path]::Combine("$PSScriptRoot", "assets", "standardtypes.csv") | ||
| # The properties of a type which should match PowerShell Standard | ||
| # These are not members of the type | ||
| $typeProperties = "IsCollectible", | ||
| "IsSZArray", | ||
| "IsByRefLike", | ||
| "IsConstructedGenericType", | ||
| "IsGenericType", | ||
| "IsGenericTypeDefinition", | ||
| "IsGenericParameter", | ||
| "IsTypeDefinition", | ||
| "IsSecurityCritical", | ||
| "IsSecuritySafeCritical", | ||
| "IsSecurityTransparent", | ||
| "IsInterface", | ||
| "IsNested", | ||
| "IsArray", | ||
| "IsByRef", | ||
| "IsPointer", | ||
| "IsGenericTypeParameter", | ||
| "IsGenericMethodParameter", | ||
| "IsVariableBoundArray", | ||
| "IsAbstract", | ||
| "IsImport", | ||
| "IsSealed", | ||
| "IsSpecialName", | ||
| "IsClass", | ||
| "IsNestedAssembly", | ||
| "IsNestedFamANDAssem", | ||
| "IsNestedFamily", | ||
| "IsNestedFamORAssem", | ||
| "IsNestedPrivate", | ||
| "IsNestedPublic", | ||
| "IsNotPublic", | ||
| "IsPublic", | ||
| "IsAutoLayout", | ||
| "IsExplicitLayout", | ||
| "IsLayoutSequential", | ||
| "IsAnsiClass", | ||
| "IsAutoClass", | ||
| "IsUnicodeClass", | ||
| "IsCOMObject", | ||
| "IsContextful", | ||
| "IsEnum", | ||
| "IsMarshalByRef", | ||
| "IsPrimitive", | ||
| "IsValueType", | ||
| "IsSignatureType", | ||
| "IsSerializable", | ||
| "IsVisible" | ||
|
|
||
| $tests = Import-Csv $assets | ForEach-Object { | ||
| @{ FullName = $_.FullName; TypeMetaData = $_ } | ||
| } | ||
| } | ||
|
|
||
| It "Type '<FullName>' should be present with correct attributes" -TestCases $tests { | ||
| param ( $FullName, $TypeMetaData ) | ||
| $type = [psobject].Assembly.GetType($FullName) | ||
| $type | Should -Not -BeNullOrEmpty | ||
| foreach ( $property in $typeProperties ) { | ||
| if ( $typeMetaData.$property -ne $type.$property ) { | ||
| throw "$property value is not correct" | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.