Fixed bug in Scanner.ScanTag() that prevented usage of local tags.

This commit is contained in:
Antoine Aubry 2012-01-22 16:05:43 +00:00
Родитель 1a5aad7430
Коммит 2924665d2b
8 изменённых файлов: 566 добавлений и 473 удалений

Просмотреть файл

@ -100,7 +100,8 @@ namespace YamlDotNet.Core
{
switch (state)
{
case ParserState.YAML_PARSE_STREAM_START_STATE: return ParseStreamStart();
case ParserState.YAML_PARSE_STREAM_START_STATE:
return ParseStreamStart();
case ParserState.YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE:
return ParseDocumentStart(true);

Просмотреть файл

@ -1,16 +1,16 @@
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) 2008, 2009, 2010, 2011 Antoine Aubry
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -307,11 +307,11 @@ namespace YamlDotNet.Core
// Is it the document start indicator?
bool isDocumentStart =
mark.Column == 0 &&
analyzer.Check('-', 0) &&
analyzer.Check('-', 1) &&
analyzer.Check('-', 2) &&
analyzer.IsBlankOrBreakOrZero(3);
mark.Column == 0 &&
analyzer.Check('-', 0) &&
analyzer.Check('-', 1) &&
analyzer.Check('-', 2) &&
analyzer.IsBlankOrBreakOrZero(3);
if (isDocumentStart)
{
@ -322,11 +322,11 @@ namespace YamlDotNet.Core
// Is it the document end indicator?
bool isDocumentEnd =
mark.Column == 0 &&
analyzer.Check('.', 0) &&
analyzer.Check('.', 1) &&
analyzer.Check('.', 2) &&
analyzer.IsBlankOrBreakOrZero(3);
mark.Column == 0 &&
analyzer.Check('.', 0) &&
analyzer.Check('.', 1) &&
analyzer.Check('.', 2) &&
analyzer.IsBlankOrBreakOrZero(3);
if (isDocumentEnd)
{
@ -476,9 +476,9 @@ namespace YamlDotNet.Core
bool isInvalidPlainScalarCharacter = analyzer.IsBlankOrBreakOrZero() || analyzer.Check("-?:,[]{}#&*!|>'\"%@`");
bool isPlainScalar =
!isInvalidPlainScalarCharacter ||
(analyzer.Check('-') && !analyzer.IsBlank(1)) ||
(flowLevel == 0 && (analyzer.Check("?:")) && !analyzer.IsBlankOrBreakOrZero(1));
!isInvalidPlainScalarCharacter ||
(analyzer.Check('-') && !analyzer.IsBlank(1)) ||
(flowLevel == 0 && (analyzer.Check("?:")) && !analyzer.IsBlankOrBreakOrZero(1));
if (isPlainScalar)
{
@ -1250,9 +1250,7 @@ namespace YamlDotNet.Core
{
// It wasn't a handle after all. Scan the rest of the tag.
suffix = ScanTagUri(null, start);
ScanTagUri(firstPart, start);
suffix = ScanTagUri(firstPart, start);
// Set the handle to '!'.
@ -2183,9 +2181,9 @@ namespace YamlDotNet.Core
if (width == 0)
{
width = (octet & 0x80) == 0x00 ? 1 :
(octet & 0xE0) == 0xC0 ? 2 :
(octet & 0xF0) == 0xE0 ? 3 :
(octet & 0xF8) == 0xF0 ? 4 : 0;
(octet & 0xE0) == 0xC0 ? 2 :
(octet & 0xF0) == 0xE0 ? 3 :
(octet & 0xF8) == 0xF0 ? 4 : 0;
if (width == 0)
{

Просмотреть файл

@ -9,7 +9,7 @@
// so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@ -19,74 +19,74 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Xml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Converters.Xml;
using System;
using System.Xml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Converters.Xml;
using YamlDotNet.Converters.Xml.Extensions;
using System.IO;
namespace YamlDotNet.UnitTests
{
[TestClass]
public class XmlConverterTests : YamlTest
{
private static YamlDocument GetDocument(string name) {
YamlStream stream = new YamlStream();
stream.Load(YamlFile(name));
Assert.IsTrue(stream.Documents.Count > 0);
return stream.Documents[0];
}
[TestMethod]
public void ScalarToXml() {
YamlDocument yaml = GetDocument("test2.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void SequenceOfScalarsToXml() {
YamlDocument yaml = GetDocument("test8.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void MappingOfScalarsToXml() {
YamlDocument yaml = GetDocument("test9.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void SequenceOfMappingAndSequencesToXml() {
YamlDocument yaml = GetDocument("test10.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void ToXmlUsingExtension() {
YamlDocument yaml = GetDocument("test10.yaml");
XmlDocument xml = yaml.ToXml();
xml.Save(Console.Out);
}
[TestMethod]
using System.IO;
namespace YamlDotNet.UnitTests
{
[TestClass]
public class XmlConverterTests : YamlTest
{
private static YamlDocument GetDocument(string name) {
YamlStream stream = new YamlStream();
stream.Load(YamlFile(name));
Assert.IsTrue(stream.Documents.Count > 0);
return stream.Documents[0];
}
[TestMethod]
public void ScalarToXml() {
YamlDocument yaml = GetDocument("test2.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void SequenceOfScalarsToXml() {
YamlDocument yaml = GetDocument("test8.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void MappingOfScalarsToXml() {
YamlDocument yaml = GetDocument("test9.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void SequenceOfMappingAndSequencesToXml() {
YamlDocument yaml = GetDocument("test10.yaml");
XmlConverter converter = new XmlConverter();
XmlDocument xml = converter.ToXml(yaml);
xml.Save(Console.Out);
}
[TestMethod]
public void ToXmlUsingExtension() {
YamlDocument yaml = GetDocument("test10.yaml");
XmlDocument xml = yaml.ToXml();
xml.Save(Console.Out);
}
[TestMethod]
public void Roundtrip()
{
YamlDocument yaml = GetDocument("test10.yaml");
@ -106,6 +106,6 @@ namespace YamlDotNet.UnitTests
Console.Error.Write(secondBuffer.ToString());
Assert.AreEqual(firstBuffer.ToString(), secondBuffer.ToString(), "The first and second XML are different.");
}
}
}
}
}

Просмотреть файл

@ -1,16 +1,16 @@
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) 2008, 2009, 2010, 2011 Antoine Aubry
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -19,374 +19,394 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using VersionDirective = YamlDotNet.Core.Tokens.VersionDirective;
using TagDirective = YamlDotNet.Core.Tokens.TagDirective;
namespace YamlDotNet.UnitTests
{
[TestClass]
public class ParserTests : YamlTest
{
private static Parser CreateParser(string name) {
return new Parser(YamlFile(name));
}
private void AssertHasNext(Parser parser) {
Assert.IsTrue(parser.MoveNext(), "The parser does not contain more events.");
}
private void AssertDoesNotHaveNext(Parser parser) {
Assert.IsFalse(parser.MoveNext(), "The parser should not contain more events.");
}
private void AssertCurrent(Parser parser, ParsingEvent expected) {
Console.WriteLine(expected.GetType().Name);
Assert.IsTrue(expected.GetType().IsAssignableFrom(parser.Current.GetType()), "The event is not of the expected type.");
foreach (var property in expected.GetType().GetProperties()) {
if(property.PropertyType != typeof(Mark) && property.CanRead) {
object value = property.GetValue(parser.Current, null);
object expectedValue = property.GetValue(expected, null);
if(expectedValue != null && Type.GetTypeCode(expectedValue.GetType()) == TypeCode.Object && expectedValue is IEnumerable) {
Console.Write("\t{0} = {{", property.Name);
bool isFirst = true;
foreach(var item in (IEnumerable)value) {
if(isFirst) {
isFirst = false;
} else {
Console.Write(", ");
}
Console.Write(item);
}
Console.WriteLine("}");
if(expectedValue is ICollection && value is ICollection) {
Assert.AreEqual(((ICollection)expectedValue).Count, ((ICollection)value).Count, "The collection does not contain the correct number of items.");
}
IEnumerator values = ((IEnumerable)value).GetEnumerator();
IEnumerator expectedValues = ((IEnumerable)expectedValue).GetEnumerator();
while(expectedValues.MoveNext()) {
Assert.IsTrue(values.MoveNext(), "The property does not contain enough items.");
Assert.AreEqual(expectedValues.Current, values.Current, string.Format("The property '{0}' is incorrect.", property.Name));
}
Assert.IsFalse(values.MoveNext(), "The property contains too many items.");
} else {
Console.WriteLine("\t{0} = {1}", property.Name, value);
Assert.AreEqual(expectedValue, value, string.Format("The property '{0}' is incorrect.", property.Name));
}
}
}
}
private void AssertNext(Parser parser, ParsingEvent expected) {
AssertHasNext(parser);
AssertCurrent(parser, expected);
}
[TestMethod]
public void EmptyDocument()
{
Parser parser = CreateParser("empty.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
private static TagDirectiveCollection defaultDirectives = new TagDirectiveCollection(new TagDirective[] {
new TagDirective("!", "!"),
new TagDirective("!!", "tag:yaml.org,2002:"),
});
[TestMethod]
public void VerifyEventsOnExample1()
{
Parser parser = CreateParser("test1.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(new VersionDirective(new Core.Version(1, 1)), new TagDirectiveCollection(new TagDirective[] {
new TagDirective("!", "!foo"),
new TagDirective("!yaml!", "tag:yaml.org,2002:"),
new TagDirective("!!", "tag:yaml.org,2002:"),
}), false));
AssertNext(parser, new Scalar(null, null, string.Empty, ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample2()
{
Parser parser = CreateParser("test2.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample3()
{
Parser parser = CreateParser("test3.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(false));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample4()
{
Parser parser = CreateParser("test4.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "another scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "yet another scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample5()
{
Parser parser = CreateParser("test5.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart("A", null, true, SequenceStyle.Flow));
AssertNext(parser, new AnchorAlias("A"));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample6()
{
Parser parser = CreateParser("test6.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, "tag:yaml.org,2002:float", "3.14", ScalarStyle.DoubleQuoted, false, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample7()
{
Parser parser = CreateParser("test7.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "", ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a plain scalar", ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a single-quoted scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a double-quoted scalar", ScalarStyle.DoubleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a literal scalar", ScalarStyle.Literal, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a folded scalar", ScalarStyle.Folded, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample8()
{
Parser parser = CreateParser("test8.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Flow));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 3", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample9()
{
Parser parser = CreateParser("test9.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Flow));
AssertNext(parser, new Scalar(null, null, "a simple key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "another value", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample10()
{
Parser parser = CreateParser("test10.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 3.1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 3.2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample11()
{
Parser parser = CreateParser("test11.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "a simple key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "another value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a mapping", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new Scalar(null, null, "a sequence", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample12()
{
Parser parser = CreateParser("test12.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "complex value", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample13()
{
Parser parser = CreateParser("test13.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "a sequence", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new Scalar(null, null, "a mapping", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample14()
{
Parser parser = CreateParser("test14.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using VersionDirective = YamlDotNet.Core.Tokens.VersionDirective;
using TagDirective = YamlDotNet.Core.Tokens.TagDirective;
namespace YamlDotNet.UnitTests
{
[TestClass]
public class ParserTests : YamlTest
{
private static Parser CreateParser(string name) {
return new Parser(YamlFile(name));
}
private void AssertHasNext(Parser parser) {
Assert.IsTrue(parser.MoveNext(), "The parser does not contain more events.");
}
private void AssertDoesNotHaveNext(Parser parser) {
Assert.IsFalse(parser.MoveNext(), "The parser should not contain more events.");
}
private void AssertCurrent(Parser parser, ParsingEvent expected) {
Console.WriteLine(expected.GetType().Name);
Assert.IsTrue(expected.GetType().IsAssignableFrom(parser.Current.GetType()), string.Format("The event is not of the expected type. Exprected: {0}, Actual: {1}", expected.GetType().Name, parser.Current.GetType().Name));
foreach (var property in expected.GetType().GetProperties()) {
if(property.PropertyType != typeof(Mark) && property.CanRead) {
object value = property.GetValue(parser.Current, null);
object expectedValue = property.GetValue(expected, null);
if(expectedValue != null && Type.GetTypeCode(expectedValue.GetType()) == TypeCode.Object && expectedValue is IEnumerable) {
Console.Write("\t{0} = {{", property.Name);
bool isFirst = true;
foreach(var item in (IEnumerable)value) {
if(isFirst) {
isFirst = false;
} else {
Console.Write(", ");
}
Console.Write(item);
}
Console.WriteLine("}");
if(expectedValue is ICollection && value is ICollection) {
Assert.AreEqual(((ICollection)expectedValue).Count, ((ICollection)value).Count, "The collection does not contain the correct number of items.");
}
IEnumerator values = ((IEnumerable)value).GetEnumerator();
IEnumerator expectedValues = ((IEnumerable)expectedValue).GetEnumerator();
while(expectedValues.MoveNext()) {
Assert.IsTrue(values.MoveNext(), "The property does not contain enough items.");
Assert.AreEqual(expectedValues.Current, values.Current, string.Format("The property '{0}' is incorrect.", property.Name));
}
Assert.IsFalse(values.MoveNext(), "The property contains too many items.");
} else {
Console.WriteLine("\t{0} = {1}", property.Name, value);
Assert.AreEqual(expectedValue, value, string.Format("The property '{0}' is incorrect.", property.Name));
}
}
}
}
private void AssertNext(Parser parser, ParsingEvent expected) {
AssertHasNext(parser);
AssertCurrent(parser, expected);
}
[TestMethod]
public void EmptyDocument()
{
Parser parser = CreateParser("empty.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
private static TagDirectiveCollection defaultDirectives = new TagDirectiveCollection(new TagDirective[] {
new TagDirective("!", "!"),
new TagDirective("!!", "tag:yaml.org,2002:"),
});
[TestMethod]
public void VerifyEventsOnExample1()
{
Parser parser = CreateParser("test1.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(new VersionDirective(new Core.Version(1, 1)), new TagDirectiveCollection(new TagDirective[] {
new TagDirective("!", "!foo"),
new TagDirective("!yaml!", "tag:yaml.org,2002:"),
new TagDirective("!!", "tag:yaml.org,2002:"),
}), false));
AssertNext(parser, new Scalar(null, null, string.Empty, ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample2()
{
Parser parser = CreateParser("test2.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample3()
{
Parser parser = CreateParser("test3.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(false));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample4()
{
Parser parser = CreateParser("test4.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, null, "a scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "another scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "yet another scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample5()
{
Parser parser = CreateParser("test5.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart("A", null, true, SequenceStyle.Flow));
AssertNext(parser, new AnchorAlias("A"));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample6()
{
Parser parser = CreateParser("test6.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new Scalar(null, "tag:yaml.org,2002:float", "3.14", ScalarStyle.DoubleQuoted, false, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample7()
{
Parser parser = CreateParser("test7.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "", ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a plain scalar", ScalarStyle.Plain, true, false));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a single-quoted scalar", ScalarStyle.SingleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a double-quoted scalar", ScalarStyle.DoubleQuoted, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a literal scalar", ScalarStyle.Literal, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new Scalar(null, null, "a folded scalar", ScalarStyle.Folded, false, true));
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample8()
{
Parser parser = CreateParser("test8.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Flow));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 3", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample9()
{
Parser parser = CreateParser("test9.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Flow));
AssertNext(parser, new Scalar(null, null, "a simple key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "another value", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample10()
{
Parser parser = CreateParser("test10.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 3.1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 3.2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample11()
{
Parser parser = CreateParser("test11.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "a simple key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "another value", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "a mapping", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new Scalar(null, null, "a sequence", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample12()
{
Parser parser = CreateParser("test12.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "complex key", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "complex value", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample13()
{
Parser parser = CreateParser("test13.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "a sequence", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new Scalar(null, null, "a mapping", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "key 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "value 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokensOnExample14()
{
Parser parser = CreateParser("test14.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, true));
AssertNext(parser, new MappingStart(null, null, true, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "key", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceStart(null, null, true, SequenceStyle.Block));
AssertNext(parser, new Scalar(null, null, "item 1", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "item 2", ScalarStyle.Plain, true, false));
AssertNext(parser, new SequenceEnd());
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
[TestMethod]
public void VerifyTokenWithLocalTags()
{
Parser parser = CreateParser("local-tags.yaml");
AssertNext(parser, new StreamStart());
AssertNext(parser, new DocumentStart(null, defaultDirectives, false));
AssertNext(parser, new MappingStart(null, "!MyObject", false, MappingStyle.Block));
AssertNext(parser, new Scalar(null, null, "a", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "1.0", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "b", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "42", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "c", ScalarStyle.Plain, true, false));
AssertNext(parser, new Scalar(null, null, "-7", ScalarStyle.Plain, true, false));
AssertNext(parser, new MappingEnd());
AssertNext(parser, new DocumentEnd(true));
AssertNext(parser, new StreamEnd());
AssertDoesNotHaveNext(parser);
}
}
}

Просмотреть файл

@ -0,0 +1,66 @@
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using YamlDotNet.RepresentationModel;
namespace YamlDotNet.UnitTests.RepresentationModel
{
[TestClass]
public class Program
{
[TestMethod]
public void LoadYamlStream()
{
// Setup the input
var input = new StringReader(Document);
// Load the stream
var yaml = new YamlStream();
yaml.Load(input);
// Examine the stream
var mapping = (YamlMappingNode)yaml.Documents[0].RootNode;
foreach (var entry in mapping.Children)
{
Console.WriteLine(((YamlScalarNode)entry.Key).Value);
}
}
private const string Document = @"---
receipt: Oz-Ware Purchase Invoice
date: 2007-08-06
customer:
given: Dorothy
family: Gale
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
- part_no: E1628
descrip: High Heeled ""Ruby"" Slippers
price: 100.27
quantity: 1
bill-to: &id001
street: |
123 Tornado Alley
Suite 16
city: East Westville
state: KS
ship-to: *id001
specialDelivery: >
Follow the Yellow Brick
Road to the Emerald City.
Pay no attention to the
man behind the curtain.
...";
}
}

Просмотреть файл

@ -1,16 +1,16 @@
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) 2008, 2009, 2010, 2011 Antoine Aubry
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -208,10 +208,10 @@ namespace YamlDotNet.UnitTests.RepresentationModel
{
Y original = new Y();
original.Child = new Y
{
Child = original,
Child2 = original
};
{
Child = original,
Child2 = original
};
serializer.Serialize(buffer, original);

Просмотреть файл

@ -56,6 +56,7 @@
<Compile Include="Core\ScannerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RepresentationModel\ObjectConverterTests.cs" />
<Compile Include="RepresentationModel\Samples.cs" />
<Compile Include="RepresentationModel\SerializationTests.cs" />
<Compile Include="RepresentationModel\YamlStreamTests.cs" />
<Compile Include="Runner.cs" />
@ -161,6 +162,9 @@
<ItemGroup>
<EmbeddedResource Include="invalid-reference.yaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="local-tags.yaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -0,0 +1,4 @@
--- !MyObject
a: 1.0
b: 42
c: -7