Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
rjmholt committed Jan 16, 2020
commit 8bde76d2e528b0d94b0f57b68b6795f4e288f9af
33 changes: 1 addition & 32 deletions Tests/Rules/UseCompatibleSyntax.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,11 @@

$script:RuleName = 'PSUseCompatibleSyntax'

$script:ScriptDefinition = @'
class MyClass
{
[string]$Hi = "Hello"

[string]GetString()
{
return $this.Hi
}
}

enum MyEnum
{
One,
Two
}

$x = [MyClass]::new()

$member = 'Hi'
Write-Host $x.$member

Write-Output 'Banana'

$method = 'GetString'
$x.$method()

$enumVal = "One"
[MyEnum]::$enumVal
'@

Describe "PSUseCompatibleSyntax" {
BeforeAll {
$testCases = @(
@{ Script = '$x = [MyClass]::new()'; Versions = @(3,4) }
@{ Script = '$member = "Hi"; $x.$member'; Versions = @(3) }
@{ Script = '$member = "Hi"; $x.$member'; Versions = @() }
@{ Script = 'Write-Host "Banana"'; Versions = @() }
@{ Script = '[System.VeryInnocuousType]::RunApiMethod($obj)'; Versions = @() }
@{ Script = '$y.$methodWithAVeryLongName()'; Versions = @(3) }
Expand Down