serverspec/specinfra — pull request #272 by maclennann (2014-12-03 19:02:38+00:00)
Title: removing an unmatched square bracket in the windows file resource

An unmatched square bracket in the file contains check causes explosions. I notice the repo is - uh - a little light on tests for Windows platforms, but here's some console output from the failed run:

```
File "c:/hello.world"
should contain "yoyoyo" (FAILED - 1)

Failures:

1) File "c:/hello.world" should contain "yoyoyo"
On host `my.hostname.example'
Failure/Error: it {should contain 'yoyoyo'}
expected File "c:/hello.world" to contain "yoyoyo"
$exitCode = 1
$ProgressPreference = "SilentlyContinue"
try {
```
$success = (**[**[Io.File]::ReadAllText("c:/hello.world") -match 'yoyoyo')
```
if ($success -is [Boolean] -and $success) { $exitCode = 0 }
} catch {
Write-Output $_.Exception.Message
}
Write-Output "Exiting with code: $exitCode"
exit $exitCode

#< CLIXML

```
**Missing ] at end of type token.**
```
_x000D__x000A_At line:5 char:73_x000D__x000A_+ $success = ([[Io.File]::ReadAllText("c:/hello.world") -match 'yoyoyo')
<<<<_x000D__x000A_ _x000D__x000A_
+ CategoryInfo : ParserError: ([Io.File]::Read...match 'yoyoyo'): _x000D__x000A_ String) [], ParentContainsErrorRecordException_x000D__x000A_ + FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfType_x000D__x000A_ _x000D__x000A_
```

After removing the unmatched bracket, it succeeds. Note: This is on win2k8r2 and powershell 2.0.