File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -104,5 +104,38 @@ function foo {
104104 $result = $editableText.ApplyEdit ($edit )
105105 $result.ToString () | Should Be $expected
106106 }
107+
108+ It " Should return a read-only collection of lines in the text" {
109+ $def = @'
110+ function foo {
111+ param(
112+ [bool] $param1
113+ )
114+ }
115+ '@
116+ $text = New-Object `
117+ - TypeName " Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText" `
118+ - ArgumentList @ ($def )
119+
120+ {$text.Lines.Add (" abc" )} | Should Throw
121+ }
122+
123+ It " Should return the correct number of lines in the text" {
124+ $def = @'
125+ function foo
126+ {
127+ get-childitem
128+ $x=1+2
129+ $hashtable = @{
130+ property1 = "value"
131+ anotherProperty = "another value"
132+ }
133+ }
134+ '@
135+ $text = New-Object `
136+ - TypeName " Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText" `
137+ - ArgumentList @ ($def )
138+ $text.LineCount | Should Be 9
139+ }
107140 }
108141}
You can’t perform that action at this time.
0 commit comments