public void PerTreeDiagnosticOptionsNewDict() { var tree = SyntaxFactory.SyntaxTree(SyntaxFactory.CompilationUnit()); var map = ImmutableDictionary.CreateRange( new[] { KeyValuePair.Create("CS00778", ReportDiagnostic.Suppress) }); var newTree = tree.WithDiagnosticOptions(map); Assert.NotNull(newTree.DiagnosticOptions); Assert.Same(map, newTree.DiagnosticOptions); Assert.NotEqual(tree, newTree); }
public void EmptySection() { var config = ParseConfigFile(@" [] my_prop = my_val"); var properties = config.GlobalSection.Properties; Assert.Equal(new[] { KeyValuePair.Create("my_prop", "my_val") }, properties); Assert.Equal(0, config.NamedSections.Length); }
public void ReservedValues() { int index = 0; var config = ParseConfigFile(string.Join(Environment.NewLine, AnalyzerConfig.ReservedValues.Select(v => "MY_KEY" + (index++) + " = " + v.ToUpperInvariant()))); index = 0; AssertEx.SetEqual( AnalyzerConfig.ReservedValues.Select(v => KeyValuePair.Create("my_key" + (index++), v)).ToList(), config.GlobalSection.Properties); }
public void EndOfLineComments() { var config = ParseConfigFile(@" my_prop2 = my val2 # Comment"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_prop2", "my val2") }, properties); }
public void SymbolsInProperties() { var config = ParseConfigFile(@" my@key1 = my_val my_key2 = my@val"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_key2", "my@val") }, properties); }
public void SpacesInProperties() { var config = ParseConfigFile(@" my prop1 = my_val1 my_prop2 = my val2"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_prop2", "my val2") }, properties); }
public void MissingKey() { var config = ParseConfigFile(@" = my_val1 my_prop = my_val2"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_prop", "my_val2") }, properties); }
public void MissingClosingBracket() { var config = ParseConfigFile(@" [*.cs my_prop = my_val"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_prop", "my_val") }, properties); Assert.Equal(0, config.NamedSections.Length); }
public void EqualsAndColon() { var config = ParseConfigFile(@" my:key1 = my_val my_key2 = my:val"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my", "key1 = my_val"), KeyValuePair.Create("my_key2", "my:val") }, properties); }
public void MissingVal() { var config = ParseConfigFile(@" my_prop1 = my_prop2 = my_val"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("my_prop1", ""), KeyValuePair.Create("my_prop2", "my_val") }, properties); }
public void LongLines() { // This example is described in the Python ConfigParser as allowing // line continuation via the RFC 822 specification, section 3.1.1 // LONG HEADER FIELDS. The VS parser does not accept this as a // valid parse for an editorconfig file. We follow similarly. var config = ParseConfigFile(@" long: this value continues in the next line"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("long", "this value continues") }, properties); }
public void LongLines() { // PROTOTYPE(editorconfig): This example is described in the Python ConfigParser as // allowing line continuation via the RFC 822 specification, section 3.1.1 LONG // HEADER FIELDS. It's unclear whether it's intended for editorconfig to permit // this interpretation. The VS parser does not. We should probably check other // parsers for completeness. var config = ParseConfigFile(@" long: this value continues in the next line"); var properties = config.GlobalSection.Properties; AssertEx.SetEqual( new[] { KeyValuePair.Create("long", "this value continues") }, properties); }