public void CanGetLineForEmptyString() { var emptyFile = ScriptFileChangeTests.CreateScriptFile(string.Empty); Assert.Single(emptyFile.FileLines); Assert.Equal(string.Empty, emptyFile.FileLines[0]); }
public void CanGetLineForSpace() { var spaceFile = ScriptFileChangeTests.CreateScriptFile(" "); Assert.Single(spaceFile.FileLines); Assert.Equal(" ", spaceFile.FileLines[0]); }
public ScriptFileGetLinesTests() { _scriptFile_noTrailingNewline = ScriptFileChangeTests.CreateScriptFile( TestString_NoTrailingNewline); _scriptFile_trailingNewline = ScriptFileChangeTests.CreateScriptFile( TestString_TrailingNewline); }
public ScriptFilePositionTests() { this.scriptFile = ScriptFileChangeTests.CreateScriptFile(@" First line Second line is longer Third line "); }
public void PropertiesInitializedCorrectlyForFile() { var path = "TestFile.ps1"; var scriptFile = ScriptFileChangeTests.CreateScriptFile(""); Assert.Equal(path, scriptFile.FilePath); Assert.Equal(path, scriptFile.ClientFilePath); Assert.True(scriptFile.IsAnalysisEnabled); Assert.False(scriptFile.IsInMemory); Assert.Empty(scriptFile.ReferencedFiles); Assert.Empty(scriptFile.DiagnosticMarkers); Assert.Single(scriptFile.ScriptTokens); Assert.Single(scriptFile.FileLines); }
public void PropertiesInitializedCorrectlyForFile() { // Use any absolute path. Even if it doesn't exist. var path = Path.Combine(Path.GetTempPath(), "TestFile.ps1"); var scriptFile = ScriptFileChangeTests.CreateScriptFile(""); Assert.Equal(path, scriptFile.FilePath, ignoreCase: !VersionUtils.IsLinux); Assert.True(scriptFile.IsAnalysisEnabled); Assert.False(scriptFile.IsInMemory); Assert.Empty(scriptFile.ReferencedFiles); Assert.Empty(scriptFile.DiagnosticMarkers); Assert.Single(scriptFile.ScriptTokens); Assert.Single(scriptFile.FileLines); }
public void CanGetSameLinesWithUnixLineBreaks() { var unixFile = ScriptFileChangeTests.CreateScriptFile(TestString_NoTrailingNewline.Replace("\r\n", "\n")); Assert.Equal(_scriptFile_noTrailingNewline.FileLines, unixFile.FileLines); }
public ScriptFileGetLinesTests() { this.scriptFile = ScriptFileChangeTests.CreateScriptFile( "Line One\r\nLine Two\r\nLine Three\r\nLine Four\r\nLine Five\r\n"); }