fixed indentation

This commit is contained in:
Yanbing Wang committed 2016-09-02 13:28:20 -07:00
1 parent 11e279d688
commit c5b90ca656
3 files changed
+78 -88

No files matched your search

@@ -164,9 +164,9 @@ Describe 'named blocks parsing' -Tags "CI" {
Test-Ast 'begin {} end' 'begin {} end' 'begin {}' 'end' Test-Ast 'begin {} end' 'begin {} end' 'begin {}' 'end'
} }
# #
# data statement # data statement
# #
Describe 'data statement parsing' -Tags "CI" { Describe 'data statement parsing' -Tags "CI" {
ShouldBeParseError 'data' MissingStatementBlockForDataSection 5 -CheckColumnNumber ShouldBeParseError 'data' MissingStatementBlockForDataSection 5 -CheckColumnNumber
ShouldBeParseError 'data foo' MissingStatementBlockForDataSection 9 -CheckColumnNumber ShouldBeParseError 'data foo' MissingStatementBlockForDataSection 9 -CheckColumnNumber
@@ -188,10 +188,9 @@ Describe 'data statement parsing' -Tags "CI" {
Test-ErrorStmt 'data -s a,b' 'data -s a,b' 'a' 'b' Test-ErrorStmt 'data -s a,b' 'data -s a,b' 'a' 'b'
} }
# #
# try/catch/finally statement # try/catch/finally statement
# #
Describe 'try/catch/finally statement parsing' -Tags "CI" { Describe 'try/catch/finally statement parsing' -Tags "CI" {
ShouldBeParseError 'try' MissingTryStatementBlock 3 ShouldBeParseError 'try' MissingTryStatementBlock 3
ShouldBeParseError 'try {}' MissingCatchOrFinally 6 ShouldBeParseError 'try {}' MissingCatchOrFinally 6
@@ -216,7 +215,6 @@ Describe 'try/catch/finally statement parsing' -Tags "CI" {
Test-ErrorStmt 'try {1} catch [int],' 'try {1} catch [int],' '{1}' '1' '1' '1' '[int]' Test-ErrorStmt 'try {1} catch [int],' 'try {1} catch [int],' '{1}' '1' '1' '1' '[int]'
} }
Describe 'switch statement parsing' -Tags "CI" { Describe 'switch statement parsing' -Tags "CI" {
ShouldBeParseError 'switch' PipelineValueRequired 6 ShouldBeParseError 'switch' PipelineValueRequired 6
ShouldBeParseError 'switch -abc' InvalidSwitchFlag,PipelineValueRequired 7,11 ShouldBeParseError 'switch -abc' InvalidSwitchFlag,PipelineValueRequired 7,11
@@ -277,7 +275,6 @@ Describe 'splatting parsing' -Tags "CI" {
ShouldBeParseError 'function foo (@a) {}' SplattingNotPermitted 14 ShouldBeParseError 'function foo (@a) {}' SplattingNotPermitted 14
} }
Describe 'Pipes parsing' -Tags "CI" { Describe 'Pipes parsing' -Tags "CI" {
ShouldBeParseError 'gps|' EmptyPipeElement 4 ShouldBeParseError 'gps|' EmptyPipeElement 4
ShouldBeParseError '1|1' ExpressionsMustBeFirstInPipeline 2 ShouldBeParseError '1|1' ExpressionsMustBeFirstInPipeline 2
@@ -291,15 +288,11 @@ Describe 'commands parsing' -Tags "CI" {
ShouldBeParseError 'gcm ,' MissingArgument 4 ShouldBeParseError 'gcm ,' MissingArgument 4
} }
#
# tokens
#
Describe 'tokens parsing' -Tags "CI" { Describe 'tokens parsing' -Tags "CI" {
ShouldBeParseError ' )' UnexpectedToken 3 ShouldBeParseError ' )' UnexpectedToken 3
ShouldBeParseError ' }' UnexpectedToken 4 -CheckColumnNumber ShouldBeParseError ' }' UnexpectedToken 4 -CheckColumnNumber
} }
Describe 'expressions parsing' -Tags "CI" { Describe 'expressions parsing' -Tags "CI" {
ShouldBeParseError '1+' ExpectedValueExpression 2 ShouldBeParseError '1+' ExpectedValueExpression 2
ShouldBeParseError '[a()][b]' UnexpectedAttribute 0 ShouldBeParseError '[a()][b]' UnexpectedAttribute 0
@@ -1,5 +1,4 @@
Describe 'Testing of script internationalization' -Tags "CI" { Describe 'Testing of script internationalization' -Tags "CI" {
BeforeAll { BeforeAll {
$dir=$PSScriptRoot $dir=$PSScriptRoot
$defaultParamValues = $PSDefaultParameterValues.Clone() $defaultParamValues = $PSDefaultParameterValues.Clone()
@@ -1,5 +1,4 @@
Describe 'get-help HelpFunc1' -Tags "CI" { Describe 'get-help HelpFunc1' -Tags "CI" {
BeforeAll { BeforeAll {
function TestHelpError { function TestHelpError {
[CmdletBinding()] [CmdletBinding()]
@@ -154,15 +153,15 @@ Describe 'get-help file' -Tags "CI" {
# Note - 2 blank lines below are intentional, do not delete # Note - 2 blank lines below are intentional, do not delete
@' @'
# .SYNOPSIS # .SYNOPSIS
# Script help, not function help # Script help, not function help
function foo function foo
{ {
} }
get-help foo get-help foo
'@ > $tmpfile '@ > $tmpfile
$x = get-help $tmpfile $x = get-help $tmpfile
@@ -173,7 +172,6 @@ Describe 'get-help file' -Tags "CI" {
} }
Describe 'get-help other tests' -Tags "CI" { Describe 'get-help other tests' -Tags "CI" {
BeforeAll { BeforeAll {
try { try {
$tempFile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1") $tempFile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
@@ -216,19 +214,19 @@ Describe 'get-help other tests' -Tags "CI" {
} }
Context 'get-help file and get-help helpFunc2' { Context 'get-help file and get-help helpFunc2' {
$script = @" $script = @"
<# <#
.SYNOPSIS .SYNOPSIS
This is script help This is script help
#> #>
<# <#
.SYNOPSIS .SYNOPSIS
This is function help for helpFunc2 This is function help for helpFunc2
#> #>
function helpFunc2 {} function helpFunc2 {}
get-help helpFunc2 get-help helpFunc2
"@ "@
Set-Content $tempFile $script Set-Content $tempFile $script
@@ -241,18 +239,18 @@ Describe 'get-help other tests' -Tags "CI" {
Context 'get-help file and get-help helpFunc2' { Context 'get-help file and get-help helpFunc2' {
$script = @" $script = @"
# #
# .SYNOPSIS # .SYNOPSIS
# This is script help # This is script help
# #
# #
# .SYNOPSIS # .SYNOPSIS
# This is function help for helpFunc2 # This is function help for helpFunc2
# #
function helpFunc2 {} function helpFunc2 {}
get-help helpFunc2 get-help helpFunc2
"@ "@
Set-Content $tempFile $script Set-Content $tempFile $script
@@ -266,28 +264,28 @@ Describe 'get-help other tests' -Tags "CI" {
Context 'get-help psuedo file' { Context 'get-help psuedo file' {
$script = @' $script = @'
########################################### ###########################################
# #
# Psuedo-Copyright header comment # Psuedo-Copyright header comment
# #
########################################### ###########################################
#requires -version 2.0 #requires -version 2.0
# #
# .Synopsis # .Synopsis
# Changes Admin passwords across all KDE servers. # Changes Admin passwords across all KDE servers.
# #
[CmdletBinding(DefaultParameterSetName="Live")] [CmdletBinding(DefaultParameterSetName="Live")]
param( param(
[Parameter( [Parameter(
ParameterSetName="Live", ParameterSetName="Live",
Mandatory=$true)] Mandatory=$true)]
$live, $live,
[Parameter( [Parameter(
ParameterSetName="Test", ParameterSetName="Test",
Mandatory=$true)] Mandatory=$true)]
$test) $test)
'@ '@
Set-Content $tempFile $script Set-Content $tempFile $script
@@ -452,41 +450,41 @@ Describe 'get-help other tests' -Tags "CI" {
} }
Context 'get-help helpFunc11' { Context 'get-help helpFunc11' {
function helpFunc11 function helpFunc11
{ {
# .Synopsis # .Synopsis
# #
# useless, sorry # useless, sorry
param( param(
# not in help # not in help
<# abc #><# help #> [parameter()] [string] <# abc #><# help #> [parameter()] [string]
$abc, $abc,
[string] [string]
# def help # def help
$def, $def,
[parameter()] [parameter()]
# ghi help # ghi help
$ghi, $ghi,
# jkl help # jkl help
$jkl, $jkl,
<#mno help#>$mno, <#mno help#>$mno,
<#pqr help#>[int]$pqr <#pqr help#>[int]$pqr
) )
} }
$x = get-help helpFunc11 -det $x = get-help helpFunc11 -det
$x.Parameters.parameter | % { $x.Parameters.parameter | % {
It '$_.description' { $_.description[0].text | Should match "^$($_.Name)\s+help" } It '$_.description' { $_.description[0].text | Should match "^$($_.Name)\s+help" }
} }
} }
Context 'get-help helpFunc12' { Context 'get-help helpFunc12' {