Skip to content

Commit 0e93348

Browse files
author
Kapil Borle
committed
Add test to verify formatter implementation
1 parent 6aab926 commit 0e93348

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
2+
$testRootDirectory = Split-Path -Parent $directory
3+
4+
Import-Module PSScriptAnalyzer
5+
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
6+
7+
Describe "Invoke-Formatter Cmdlet" {
8+
Context "When no settings are given" {
9+
It "Should format using default settings" {
10+
$def = @'
11+
function foo
12+
{
13+
get-childitem
14+
$x=1+2
15+
$hashtable = @{
16+
property1 = "value"
17+
anotherProperty = "another value"
18+
}
19+
}
20+
'@
21+
$expected = @'
22+
function foo {
23+
get-childitem
24+
$x = 1 + 2
25+
$hashtable = @{
26+
property1 = "value"
27+
anotherProperty = "another value"
28+
}
29+
}
30+
'@
31+
32+
Invoke-Formatter -ScriptDefinition $def | Should Be $expected
33+
}
34+
}
35+
36+
}

0 commit comments

Comments
 (0)