public void ExcludeEmptyPaddingLines_whitespace_list() { var loopState = new LoopState(); loopState.AppendLine(""); loopState.AppendLine(" "); Approvals.Verify(loopState.GetLines()); }
public void TrimIndentation() { var loopState = new LoopState(); loopState.AppendLine(" Line1"); loopState.AppendLine(" Line2"); loopState.AppendLine(" Line2"); Approvals.Verify(loopState.GetLines()); }
public void TrimIndentation_with_mis_match() { var loopState = new LoopState(); loopState.AppendLine(" Line2"); loopState.AppendLine(" "); loopState.AppendLine(" Line4"); Approvals.Verify(loopState.GetLines()); }
Snippet BuildSnippet(IndexReader stringReader, string path, LoopState loopState, string language) { var startRow = loopState.StartLine + 1; string error; if (isShared && loopState.Version != null) { return(Snippet.BuildError( error: "Shared snippets cannot contain a version", path: path, lineNumberInError: startRow, key: loopState.Key)); } VersionRange snippetVersion; if (!TryParseVersionAndPackage(loopState, out snippetVersion, out error)) { return(Snippet.BuildError( error: error, path: path, lineNumberInError: startRow, key: loopState.Key)); } var value = loopState.GetLines(); if (value.IndexOfAny(invalidCharacters) > -1) { var joinedInvalidChars = $@"'{string.Join("', '", invalidCharacters)}'"; return(Snippet.BuildError( error: $"Snippet contains invalid characters ({joinedInvalidChars}). This was probably caused by copying code from MS Word or Outlook. Dont do that.", path: path, lineNumberInError: startRow, key: loopState.Key)); } if (isShared) { return(Snippet.BuildShared( startLine: startRow, endLine: stringReader.Index, key: loopState.Key, value: value, path: path, language: language.ToLowerInvariant())); } return(Snippet.Build( startLine: startRow, endLine: stringReader.Index, key: loopState.Key, version: snippetVersion, value: value, path: path, language: language.ToLowerInvariant(), package: package, isCurrent: isCurrent)); }
public void ExcludeEmptyPaddingLines_empty_list() { var loopState = new LoopState(); Approvals.Verify(loopState.GetLines()); }