Skip to content
Browse files

Replace xUnit test framework with Fixie.

  • Loading branch information...
1 parent eb1f9b2 commit b836046667e357c77d77d7b4a2c19e8515fa7994 @plioi committed Apr 6, 2013
View
4 default.ps1
@@ -25,8 +25,8 @@ task Package -depends Test {
}
task Test -depends Compile {
- $xunitRunner = join-path $src "packages\xunit.runners.1.9.1\tools\xunit.console.clr4.exe"
- exec { & $xunitRunner $src\$project.Test\bin\$configuration\$project.Test.dll }
+ $fixieRunner = join-path $src "packages\Fixie.0.0.1.24\lib\net45\Fixie.Console.exe"
+ exec { & $fixieRunner $src\$project.Test\bin\$configuration\$project.Test.dll }
}
task Compile -depends CommonAssemblyInfo {
View
1 src/.nuget/packages.config
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="psake" version="4.2.0.1" />
- <package id="xunit.runners" version="1.9.1" />
</packages>
View
10 src/Parsley.Test/ErrorMessageListTests.cs
@@ -1,23 +1,19 @@
using Should;
-using Xunit;
namespace Parsley
{
public class ErrorMessageListTests
{
- [Fact]
public void ShouldProvideSharedEmptyInstance()
{
ErrorMessageList.Empty.ShouldBeSameAs(ErrorMessageList.Empty);
}
- [Fact]
public void CanBeEmpty()
{
ErrorMessageList.Empty.ToString().ShouldEqual("");
}
- [Fact]
public void CreatesNewCollectionWhenAddingItems()
{
ErrorMessageList list = ErrorMessageList.Empty.With(ErrorMessage.Expected("expectation"));
@@ -26,15 +22,13 @@ public void CreatesNewCollectionWhenAddingItems()
list.ShouldNotBeSameAs(ErrorMessageList.Empty);
}
- [Fact]
public void CanIncludeUnknownErrors()
{
ErrorMessageList.Empty
.With(ErrorMessage.Unknown())
.ToString().ShouldEqual("Parse error.");
}
- [Fact]
public void CanIncludeMultipleExpectations()
{
ErrorMessageList.Empty
@@ -56,7 +50,6 @@ public void CanIncludeMultipleExpectations()
.ToString().ShouldEqual("A, B, C or D expected");
}
- [Fact]
public void OmitsDuplicateExpectationsFromExpectationLists()
{
ErrorMessageList.Empty
@@ -71,7 +64,6 @@ public void OmitsDuplicateExpectationsFromExpectationLists()
.ToString().ShouldEqual("A, B or C expected");
}
- [Fact]
public void CanIncludeBacktrackErrors()
{
var deepBacktrack = ErrorMessage.Backtrack(new Position(3, 4),
@@ -106,7 +98,6 @@ public void CanIncludeBacktrackErrors()
.ToString().ShouldEqual("G or H expected [(1, 2): E or F expected] [(2, 3): C or D expected [(3, 4): A or B expected]]");
}
- [Fact]
public void CanMergeTwoLists()
{
var first = ErrorMessageList.Empty
@@ -125,7 +116,6 @@ public void CanMergeTwoLists()
.ToString().ShouldEqual("A, B, C, D or E expected");
}
- [Fact]
public void OmitsUnknownErrorsWhenAdditionalErrorsExist()
{
ErrorMessageList.Empty
View
4 src/Parsley.Test/ErrorMessageTests.cs
@@ -1,26 +1,22 @@
using Should;
-using Xunit;
namespace Parsley
{
public class ErrorMessageTests
{
- [Fact]
public void CanIndicateGenericErrors()
{
var error = ErrorMessage.Unknown();
error.ToString().ShouldEqual("Parse error.");
}
- [Fact]
public void CanIndicateSpecificExpectation()
{
var error = (ExpectedErrorMessage)ErrorMessage.Expected("statement");
error.Expectation.ShouldEqual("statement");
error.ToString().ShouldEqual("statement expected");
}
- [Fact]
public void CanIndicateErrorsWhichCausedBacktracking()
{
var position = new Position(3, 4);
View
6 src/Parsley.Test/ErrorTests.cs
@@ -1,6 +1,5 @@
using System;
using Should;
-using Xunit;
namespace Parsley
{
@@ -16,14 +15,12 @@ public ErrorTests()
endOfInput = new TokenStream(lexer.Tokenize(""));
}
- [Fact]
public void CanIndicateErrorsAtTheCurrentPosition()
{
new Error<object>(endOfInput, ErrorMessage.Unknown()).ErrorMessages.ToString().ShouldEqual("Parse error.");
new Error<object>(endOfInput, ErrorMessage.Expected("statement")).ErrorMessages.ToString().ShouldEqual("statement expected");
}
- [Fact]
public void CanIndicateMultipleErrorsAtTheCurrentPosition()
{
var errors = ErrorMessageList.Empty
@@ -33,21 +30,18 @@ public void CanIndicateMultipleErrorsAtTheCurrentPosition()
new Error<object>(endOfInput, errors).ErrorMessages.ToString().ShouldEqual("A or B expected");
}
- [Fact]
public void ThrowsWhenAttemptingToGetParsedValue()
{
Func<object> inspectParsedValue = () => new Error<object>(x, ErrorMessage.Unknown()).Value;
inspectParsedValue.ShouldThrow<MemberAccessException>("(1, 1): Parse error.");
}
- [Fact]
public void HasRemainingUnparsedTokens()
{
new Error<object>(x, ErrorMessage.Unknown()).UnparsedTokens.ShouldEqual(x);
new Error<object>(endOfInput, ErrorMessage.Unknown()).UnparsedTokens.ShouldEqual(endOfInput);
}
- [Fact]
public void ReportsErrorState()
{
new Error<object>(x, ErrorMessage.Unknown()).Success.ShouldBeFalse();
View
4 src/Parsley.Test/GrammarRuleTests.cs
@@ -1,12 +1,10 @@
using System.Linq;
using Should;
-using Xunit;
namespace Parsley
{
public class GrammarRuleTests : Grammar
{
- [Fact]
public void CanDefineMutuallyRecursiveRules()
{
var tokens = new CharLexer().Tokenize("(A)");
@@ -21,7 +19,6 @@ public void CanDefineMutuallyRecursiveRules()
expression.Parses(tokens).WithValue("A");
}
- [Fact]
public void HasAnOptionallyProvidedName()
{
var unnamed = new GrammarRule<string>();
@@ -31,7 +28,6 @@ public void HasAnOptionallyProvidedName()
named.Name.ShouldEqual("Named");
}
- [Fact]
public void ProvidesAdviceWhenRuleIsUsedBeforeBeingInitialized()
{
var tokens = new CharLexer().Tokenize("123").ToArray();
View
26 src/Parsley.Test/GrammarTests.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using Should;
-using Xunit;
namespace Parsley
{
@@ -47,20 +46,17 @@ private static Action<IEnumerable<Token>> Literals(params string[] expectedLiter
return tokens => tokens.ShouldList(expectedLiterals.Select(Literal).ToArray());
}
- [Fact]
public void CanFailWithoutConsumingInput()
{
Fail<string>().FailsToParse(Tokenize("ABC")).LeavingUnparsedTokens("A", "B", "C");
}
- [Fact]
public void CanDetectTheEndOfInputWithoutAdvancing()
{
EndOfInput.Parses(Tokenize("")).WithValue(Literal(""));
EndOfInput.FailsToParse(Tokenize("!")).LeavingUnparsedTokens("!").WithMessage("(1, 1): end of input expected");
}
- [Fact]
public void CanDemandThatAGivenKindOfTokenAppearsNext()
{
Token(SampleLexer.Letter).Parses(Tokenize("A")).WithValue(Literal("A"));
@@ -70,15 +66,13 @@ public void CanDemandThatAGivenKindOfTokenAppearsNext()
Token(SampleLexer.Digit).Parses(Tokenize("0")).WithValue(Literal("0"));
}
- [Fact]
public void CanDemandThatAGivenTokenLiteralAppearsNext()
{
Token("A").Parses(Tokenize("A")).WithValue(Literal("A"));
Token("A").PartiallyParses(Tokenize("A!")).LeavingUnparsedTokens("!").WithValue(Literal("A"));
Token("A").FailsToParse(Tokenize("B")).LeavingUnparsedTokens("B").WithMessage("(1, 1): A expected");
}
- [Fact]
public void ApplyingARuleZeroOrMoreTimes()
{
var parser = ZeroOrMore(AB);
@@ -102,7 +96,6 @@ public void ApplyingARuleZeroOrMoreTimes()
infiniteLoop.ShouldThrow<Exception>("Parser encountered a potential infinite loop at position (1, 1).");
}
- [Fact]
public void ApplyingARuleOneOrMoreTimes()
{
var parser = OneOrMore(AB);
@@ -126,7 +119,6 @@ public void ApplyingARuleOneOrMoreTimes()
infiniteLoop.ShouldThrow<Exception>("Parser encountered a potential infinite loop at position (1, 1).");
}
- [Fact]
public void ApplyingARuleZeroOrMoreTimesInterspersedByASeparatorRule()
{
var parser = ZeroOrMore(AB, COMMA);
@@ -139,7 +131,6 @@ public void ApplyingARuleZeroOrMoreTimesInterspersedByASeparatorRule()
parser.FailsToParse(Tokenize("AB,A")).AtEndOfInput().WithMessage("(1, 5): B expected");
}
- [Fact]
public void ApplyingARuleOneOrMoreTimesInterspersedByASeparatorRule()
{
var parser = OneOrMore(AB, COMMA);
@@ -152,7 +143,6 @@ public void ApplyingARuleOneOrMoreTimesInterspersedByASeparatorRule()
parser.FailsToParse(Tokenize("AB,A")).AtEndOfInput().WithMessage("(1, 5): B expected");
}
- [Fact]
public void ApplyingARuleBetweenTwoOtherRules()
{
var parser = Between(A, B, A);
@@ -166,15 +156,13 @@ public void ApplyingARuleBetweenTwoOtherRules()
parser.Parses(Tokenize("ABA")).WithValue(Literal("B"));
}
- [Fact]
public void ParsingAnOptionalRuleZeroOrOneTimes()
{
Optional(AB).PartiallyParses(Tokenize("AB.")).LeavingUnparsedTokens(".").WithValue(Literal("AB"));
Optional(AB).PartiallyParses(Tokenize(".")).LeavingUnparsedTokens(".").WithValue(token => token.ShouldBeNull());
Optional(AB).FailsToParse(Tokenize("AC.")).LeavingUnparsedTokens("C", ".").WithMessage("(1, 2): B expected");
}
- [Fact]
public void AttemptingToParseRuleButBacktrackingUponFailure()
{
//When p succeeds, Attempt(p) is the same as p.
@@ -187,7 +175,6 @@ public void AttemptingToParseRuleButBacktrackingUponFailure()
Attempt(AB).FailsToParse(Tokenize("A!")).LeavingUnparsedTokens("A", "!").WithMessage("(1, 1): [(1, 2): B expected]");
}
- [Fact]
public void ImprovingDefaultMessagesWithAKnownExpectation()
{
var labeled = Label(AB, "'A' followed by 'B'");
@@ -240,34 +227,29 @@ private static Action<Token> Literal(string expectedLiteral)
return t => t.Literal.ShouldEqual(expectedLiteral);
}
- [Fact]
public void ChoosingBetweenZeroAlternativesAlwaysFails()
{
Choice<string>().FailsToParse(Tokenize("ABC")).LeavingUnparsedTokens("A", "B", "C");
}
- [Fact]
public void ChoosingBetweenOneAlternativeParserIsEquivalentToThatParser()
{
Choice(A).Parses(Tokenize("A")).WithValue(Literal("A"));
Choice(A).PartiallyParses(Tokenize("AB")).LeavingUnparsedTokens("B").WithValue(Literal("A"));
Choice(A).FailsToParse(Tokenize("B")).LeavingUnparsedTokens("B").WithMessage("(1, 1): A expected");
}
- [Fact]
public void FirstParserCanSucceedWithoutExecutingOtherAlternatives()
{
Choice(A, NeverExecuted).Parses(Tokenize("A")).WithValue(Literal("A"));
}
- [Fact]
public void SubsequentParserCanSucceedWhenPreviousParsersFailWithoutConsumingInput()
{
Choice(B, A).Parses(Tokenize("A")).WithValue(Literal("A"));
Choice(C, B, A).Parses(Tokenize("A")).WithValue(Literal("A"));
}
- [Fact]
public void SubsequentParserWillNotBeAttemptedWhenPreviousParserFailsAfterConsumingInput()
{
//As soon as something consumes input, it's failure and message win.
@@ -280,14 +262,12 @@ public void SubsequentParserWillNotBeAttemptedWhenPreviousParserFailsAfterConsum
Choice(C, AB, NeverExecuted).FailsToParse(Tokenize("A")).AtEndOfInput().WithMessage("(1, 2): B expected");
}
- [Fact]
public void MergesErrorMessagesWhenParsersFailWithoutConsumingInput()
{
Choice(A, B).FailsToParse(Tokenize("")).AtEndOfInput().WithMessage("(1, 1): A or B expected");
Choice(A, B, C).FailsToParse(Tokenize("")).AtEndOfInput().WithMessage("(1, 1): A, B or C expected");
}
- [Fact]
public void MergesPotentialErrorMessagesWhenParserSucceedsWithoutConsumingInput()
{
//Choice really shouldn't be used with parsers that can succeed without
@@ -333,37 +313,31 @@ public GrammarRuleNameInferenceTests()
InferGrammarRuleNames();
}
- [Fact]
public void WillNotInferNameWhenNameIsAlreadyProvided()
{
AlreadyNamedRule.Name.ShouldEqual("This name is not inferred.");
}
- [Fact]
public void InfersNamesOfPublicStaticGrammarRules()
{
PublicStaticRule.Name.ShouldEqual("PublicStaticRule");
}
- [Fact]
public void InfersNamesOfPrivateStaticGrammarRules()
{
PrivateStaticRule.Name.ShouldEqual("PrivateStaticRule");
}
- [Fact]
public void InfersNamesOfPublicInstanceGrammarRules()
{
PublicInstanceRule.Name.ShouldEqual("PublicInstanceRule");
}
- [Fact]
public void InfersNamesOfPrivateInstanceGrammarRules()
{
PrivateInstanceRule.Name.ShouldEqual("PrivateInstanceRule");
}
- [Fact]
public void SilentlyIgnoresNullRules()
{
NullRule.ShouldBeNull();
View
10 src/Parsley.Test/IntegrationTests/Json/JsonGrammarTests.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Should;
-using Xunit;
namespace Parsley.IntegrationTests.Json
{
@@ -11,39 +10,34 @@ private static IEnumerable<Token> Tokenize(string input)
return new JsonLexer().Tokenize(input);
}
- [Fact]
public void ParsesTrueLiteral()
{
var tokens = Tokenize("true");
Json.Parses(tokens).WithValue(true);
}
- [Fact]
public void ParsesFalseLiteral()
{
var tokens = Tokenize("false");
Json.Parses(tokens).WithValue(false);
}
- [Fact]
public void ParsesNullLiteral()
{
var tokens = Tokenize("null");
Json.Parses(tokens).WithValue(value => value.ShouldBeNull());
}
- [Fact]
public void ParsesNumbers()
{
var tokens = Tokenize("10.123E-11");
Json.Parses(tokens).WithValue(10.123E-11m);
}
- [Fact]
public void ParsesQuotations()
{
var empty = Tokenize("\"\"");
@@ -54,7 +48,6 @@ public void ParsesQuotations()
Json.Parses(filled).WithValue(expected);
}
- [Fact]
public void ParsesArrays()
{
var empty = Tokenize("[]");
@@ -65,7 +58,6 @@ public void ParsesArrays()
Json.Parses(filled).WithValue(value => value.ShouldEqual(new[] { 0m, 1m, 2m }));
}
- [Fact]
public void ParsesDictionaries()
{
var empty = Tokenize("{}");
@@ -82,7 +74,6 @@ public void ParsesDictionaries()
});
}
- [Fact]
public void ParsesComplexJsonValues()
{
const string complex = @"
@@ -115,7 +106,6 @@ public void ParsesComplexJsonValues()
});
}
- [Fact]
public void RequiresEndOfInputAfterFirstValidJsonValue()
{
Json.FailsToParse(Tokenize("true $garbage$")).LeavingUnparsedTokens("$garbage$").WithMessage("(1, 6): end of input expected");
View
6 src/Parsley.Test/IntegrationTests/Json/JsonLexerTests.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Should;
-using Xunit;
namespace Parsley.IntegrationTests.Json
{
@@ -12,7 +11,6 @@ private static IEnumerable<Token> Tokenize(string input)
return new JsonLexer().Tokenize(input);
}
- [Fact]
public void RecognizesSkippableWhitespace()
{
Tokenize(" ").ShouldBeEmpty();
@@ -22,7 +20,6 @@ public void RecognizesSkippableWhitespace()
Tokenize(" \t\n\r").ShouldBeEmpty();
}
- [Fact]
public void RecognizesKeywords()
{
Tokenize("null").Single().ShouldEqual(JsonLexer.@null, "null");
@@ -35,7 +32,6 @@ public void RecognizesKeywords()
t => t.ShouldEqual(JsonLexer.@false, "false", 1, 11));
}
- [Fact]
public void RecognizesOperators()
{
Tokenize(",").Single().ShouldEqual(JsonLexer.Comma, ",");
@@ -54,7 +50,6 @@ public void RecognizesOperators()
t => t.ShouldEqual(JsonLexer.Colon, ":", 1, 6));
}
- [Fact]
public void RecognizesQuotations()
{
Tokenize("\"\"").Single().ShouldEqual(JsonLexer.Quotation, "\"\"");
@@ -76,7 +71,6 @@ public void RecognizesQuotations()
t => t.ShouldEqual(JsonLexer.Quotation, "\" c \"", 1, 13));
}
- [Fact]
public void RecognizesNumbers()
{
Tokenize("0").Single().ShouldEqual(JsonLexer.Number, "0");
View
3 src/Parsley.Test/LambdaParserTests.cs
@@ -1,10 +1,7 @@
-using Xunit;
-
namespace Parsley
{
public class LambdaParserTests
{
- [Fact]
public void CreatesParsersFromLambdas()
{
var succeeds = new LambdaParser<string>(tokens => new Parsed<string>("AA", tokens.Advance().Advance()));
View
5 src/Parsley.Test/LexerTests.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Should;
-using Xunit;
namespace Parsley
{
@@ -22,13 +21,11 @@ private IEnumerable<Token> Tokenize(string input)
return new Lexer(lower, upper, space).Tokenize(input);
}
- [Fact]
public void ProvidesEmptyEnumerableForEmptyText()
{
Tokenize("").ShouldBeEmpty();
}
- [Fact]
public void UsesPrioritizedTokenMatchersToTokenize()
{
Tokenize("ABCdefGHI")
@@ -37,15 +34,13 @@ public void UsesPrioritizedTokenMatchersToTokenize()
t => t.ShouldEqual(upper, "GHI", 1, 7));
}
- [Fact]
public void ProvidesTokenAtUnrecognizedInput()
{
Tokenize("ABC!def")
.ShouldList(t => t.ShouldEqual(upper, "ABC", 1, 1),
t => t.ShouldEqual(TokenKind.Unknown, "!def", 1, 4));
}
- [Fact]
public void SkipsPastSkippableTokens()
{
Tokenize(" ").ShouldBeEmpty();
View
9 src/Parsley.Test/OperatorPrecedenceParserTests.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Should;
-using Xunit;
namespace Parsley
{
@@ -31,43 +30,37 @@ public OperatorPrecedenceParserTests()
select new Form(callable, arguments));
}
- [Fact]
public void ParsesRegisteredTokensIntoCorrespondingAtoms()
{
Parses("1", "1");
Parses("square", "square");
}
- [Fact]
public void ParsesUnitExpressionsStartedByRegisteredTokens()
{
Parses("(0)", "0");
Parses("(square)", "square");
Parses("(1+4)/(2-3)*4", "(* (/ (+ 1 4) (- 2 3)) 4)");
}
- [Fact]
public void ParsesPrefixExpressionsStartedByRegisteredToken()
{
Parses("-1", "(- 1)");
Parses("-(-1)", "(- (- 1))");
}
- [Fact]
public void ParsesPostfixExpressionsEndedByRegisteredToken()
{
Parses("1++", "(++ 1)");
Parses("1++--", "(-- (++ 1))");
}
- [Fact]
public void ParsesExpressionsThatExtendTheLeftSideExpressionWhenTheRegisteredTokenIsEncountered()
{
Parses("square(1)", "(square 1)");
Parses("square(1,2)", "(square 1 2)");
}
- [Fact]
public void ParsesBinaryOperationsRespectingPrecedenceAndAssociativity()
{
Parses("1+2", "(+ 1 2)");
@@ -92,7 +85,6 @@ public void ParsesBinaryOperationsRespectingPrecedenceAndAssociativity()
Parses("1^2+3^4", "(+ (^ 1 2) (^ 3 4))");
}
- [Fact]
public void ProvidesErrorAtAppropriatePositionWhenUnitParsersFail()
{
//Upon unit-parser failures, stop!
@@ -103,7 +95,6 @@ public void ProvidesErrorAtAppropriatePositionWhenUnitParsersFail()
expression.FailsToParse(Tokenize("(*")).LeavingUnparsedTokens("*").WithMessage("(1, 2): Parse error.");
}
- [Fact]
public void ProvidesErrorAtAppropriatePositionWhenExtendParsersFail()
{
//Upon extend-parser failures, stop!
View
6 src/Parsley.Test/ParsedTests.cs
@@ -1,5 +1,4 @@
using Should;
-using Xunit;
namespace Parsley
{
@@ -12,19 +11,16 @@ public ParsedTests()
unparsed = new TokenStream(new CharLexer().Tokenize("0"));
}
- [Fact]
public void HasAParsedValue()
{
new Parsed<string>("parsed", unparsed).Value.ShouldEqual("parsed");
}
- [Fact]
public void HasNoErrorMessageByDefault()
{
new Parsed<string>("x", unparsed).ErrorMessages.ShouldEqual(ErrorMessageList.Empty);
}
- [Fact]
public void CanIndicatePotentialErrors()
{
var potentialErrors = ErrorMessageList.Empty
@@ -34,13 +30,11 @@ public void CanIndicatePotentialErrors()
new Parsed<object>("x", unparsed, potentialErrors).ErrorMessages.ShouldEqual(potentialErrors);
}
- [Fact]
public void HasRemainingUnparsedTokens()
{
new Parsed<string>("parsed", unparsed).UnparsedTokens.ShouldEqual(unparsed);
}
- [Fact]
public void ReportsNonerrorState()
{
new Parsed<string>("parsed", unparsed).Success.ShouldBeTrue();
View
5 src/Parsley.Test/ParserQueryTests.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Xunit;
namespace Parsley
{
@@ -14,15 +13,13 @@ private static IEnumerable<Token> Tokenize(string input)
return new CharLexer().Tokenize(input);
}
- [Fact]
public void CanBuildParserWhichSimulatesSuccessfulParsingOfGivenValueWithoutConsumingInput()
{
var parser = 1.SucceedWithThisValue();
parser.PartiallyParses(Tokenize("input")).LeavingUnparsedTokens("i", "n", "p", "u", "t").WithValue(1);
}
- [Fact]
public void CanBuildParserFromSingleSimplerParser()
{
var parser = from x in Next
@@ -31,7 +28,6 @@ public void CanBuildParserFromSingleSimplerParser()
parser.PartiallyParses(Tokenize("xy")).LeavingUnparsedTokens("y").WithValue("X");
}
- [Fact]
public void CanBuildParserFromOrderedSequenceOfSimplerParsers()
{
var parser = (from a in Next
@@ -42,7 +38,6 @@ public void CanBuildParserFromOrderedSequenceOfSimplerParsers()
parser.PartiallyParses(Tokenize("abcdef")).LeavingUnparsedTokens("d", "e", "f").WithValue("ABC");
}
- [Fact]
public void PropogatesErrorsWithoutRunningRemainingParsers()
{
Parser<string> Fail = Grammar.Fail<string>();
View
7 src/Parsley.Test/Parsley.Test.csproj
@@ -36,15 +36,14 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Fixie">
+ <HintPath>..\packages\Fixie.0.0.1.24\lib\net45\Fixie.dll</HintPath>
+ </Reference>
<Reference Include="Should">
<HintPath>..\packages\Should.1.1.12.0\lib\Should.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
- <Reference Include="xunit, Version=1.9.1.1600, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\xunit.1.9.1\lib\net20\xunit.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
View
8 src/Parsley.Test/TextTests.cs
@@ -1,13 +1,11 @@
using System;
using System.Text;
using Should;
-using Xunit;
namespace Parsley
{
public class TextTests
{
- [Fact]
public void CanPeekAheadNCharacters()
{
var empty = new Text("");
@@ -23,7 +21,6 @@ public void CanPeekAheadNCharacters()
abc.Peek(100).ShouldEqual("abc");
}
- [Fact]
public void CanAdvanceAheadNCharacters()
{
var empty = new Text("");
@@ -39,14 +36,12 @@ public void CanAdvanceAheadNCharacters()
abc.Advance(100).ToString().ShouldEqual("");
}
- [Fact]
public void DetectsTheEndOfInput()
{
new Text("!").EndOfInput.ShouldBeFalse();
new Text("").EndOfInput.ShouldBeTrue();
}
- [Fact]
public void CanMatchLeadingCharactersByTokenRegex()
{
var end = new TokenRegex(@"$");
@@ -76,7 +71,6 @@ public void CanMatchLeadingCharactersByTokenRegex()
abc123.Advance(6).Match(alphanumerics).ShouldFail();
}
- [Fact]
public void CanMatchLeadingCharactersByPredicate()
{
Predicate<char> letters = Char.IsLetter;
@@ -104,14 +98,12 @@ public void CanMatchLeadingCharactersByPredicate()
abc123.Advance(6).Match(alphanumerics).ShouldFail();
}
- [Fact]
public void NormalizesLineEndingsToSingleLineFeedCharacter()
{
var multiline = new Text("Line 1\rLine 2\nLine 3\r\nLine 4");
multiline.ToString().ShouldEqual("Line 1\nLine 2\nLine 3\nLine 4");
}
- [Fact]
public void CanGetCurrentPosition()
{
var empty = new Text("");
View
8 src/Parsley.Test/TokenKindTests.cs
@@ -1,7 +1,6 @@
using System;
using System.Text.RegularExpressions;
using Should;
-using Xunit;
namespace Parsley
{
@@ -20,7 +19,6 @@ public TokenKindTests()
abcDEF = new Text("abcDEF");
}
- [Fact]
public void ProducesNullTokenUponFailedMatch()
{
Token token;
@@ -29,7 +27,6 @@ public void ProducesNullTokenUponFailedMatch()
token.ShouldBeNull();
}
- [Fact]
public void ProducesTokenUponSuccessfulMatch()
{
Token token;
@@ -44,23 +41,20 @@ public void ProducesTokenUponSuccessfulMatch()
token.ShouldEqual(caseInsensitive, "abcDEF", 1, 1);
}
- [Fact]
public void HasDescriptiveName()
{
lower.Name.ShouldEqual("Lowercase");
upper.Name.ShouldEqual("Uppercase");
caseInsensitive.Name.ShouldEqual("Case Insensitive");
}
- [Fact]
public void UsesDescriptiveNameForToString()
{
lower.ToString().ShouldEqual("Lowercase");
upper.ToString().ShouldEqual("Uppercase");
caseInsensitive.ToString().ShouldEqual("Case Insensitive");
}
- [Fact]
public void ProvidesConvenienceSubclassForDefiningKeywords()
{
Token token;
@@ -84,7 +78,6 @@ public void ProvidesConvenienceSubclassForDefiningKeywords()
notJustLetters.ShouldThrow<ArgumentException>("Keywords may only contain letters.\r\nParameter name: word");
}
- [Fact]
public void ProvidesConvenienceSubclassForDefiningOperators()
{
Token token;
@@ -120,7 +113,6 @@ public void ProvidesConvenienceSubclassForDefiningOperators()
token.ShouldEqual(doubleStar, "**", 1, 1);
}
- [Fact]
public void ProvidesConvenienceSubclassForTokensThatDoNotMatchLiteralsFromTheInput()
{
Token token;
View
5 src/Parsley.Test/TokenRegexTests.cs
@@ -1,12 +1,10 @@
using System.Text.RegularExpressions;
using Should;
-using Xunit;
namespace Parsley
{
public class TokenRegexTests
{
- [Fact]
public void CanMatchRegexStartingFromGivenCharacterPosition()
{
var regex = new TokenRegex(@"[a-z]+");
@@ -20,7 +18,6 @@ public void CanMatchRegexStartingFromGivenCharacterPosition()
regex.Match("123abc0", 4).Value.ShouldEqual("bc");
}
- [Fact]
public void CanMatchMultilineAndCommentedRegexes()
{
var regex = new TokenRegex(
@@ -34,7 +31,6 @@ public void CanMatchMultilineAndCommentedRegexes()
regex.Match("$23ab!", 3).Value.ShouldEqual("ab");
}
- [Fact]
public void SupportsOptionalRegexOptions()
{
var regex = new TokenRegex(@"[a-z]+", RegexOptions.IgnoreCase);
@@ -48,7 +44,6 @@ public void SupportsOptionalRegexOptions()
regex.Match("123aBc0", 4).Value.ShouldEqual("Bc");
}
- [Fact]
public void HasStringRepresentation()
{
new TokenRegex(@"[a-zA-Z0-9]*").ToString().ShouldEqual(@"[a-zA-Z0-9]*");
View
10 src/Parsley.Test/TokenStreamTests.cs
@@ -1,7 +1,5 @@
using System.Collections.Generic;
-using System.Linq;
using Should;
-using Xunit;
namespace Parsley
{
@@ -34,7 +32,6 @@ private IEnumerable<Token> Tokens()
yield return new Token(TokenKind.EndOfInput, new Position(1, 10), "");
}
- [Fact]
public void ProvidesEndOfInputTokenWhenGivenEmptyEnumerator()
{
var tokens = new TokenStream(Empty());
@@ -43,21 +40,18 @@ public void ProvidesEndOfInputTokenWhenGivenEmptyEnumerator()
tokens.Advance().ShouldBeSameAs(tokens);
}
- [Fact]
public void ProvidesCurrentToken()
{
var tokens = new TokenStream(Tokens());
tokens.Current.ShouldEqual(upper, "ABC", 1, 1);
}
- [Fact]
public void AdvancesToTheNextToken()
{
var tokens = new TokenStream(Tokens());
tokens.Advance().Current.ShouldEqual(lower, "def", 1, 4);
}
- [Fact]
public void ProvidesEndOfInputTokenAfterEnumeratorIsExhausted()
{
var tokens = new TokenStream(OneToken());
@@ -67,14 +61,12 @@ public void ProvidesEndOfInputTokenAfterEnumeratorIsExhausted()
end.Advance().ShouldBeSameAs(end);
}
- [Fact]
public void TryingToAdvanceBeyondEndOfInputResultsInNoMovement()
{
var tokens = new TokenStream(Empty());
tokens.ShouldBeSameAs(tokens.Advance());
}
- [Fact]
public void DoesNotChangeStateAsUnderlyingEnumeratorIsTraversed()
{
var tokens = new TokenStream(Tokens());
@@ -101,7 +93,6 @@ public void DoesNotChangeStateAsUnderlyingEnumeratorIsTraversed()
fourth.Advance().ShouldBeSameAs(fourth);
}
- [Fact]
public void AllowsRepeatableTraversalWhileTraversingUnderlyingEnumeratorItemsAtMostOnce()
{
var tokens = new TokenStream(Tokens());
@@ -114,7 +105,6 @@ public void AllowsRepeatableTraversalWhileTraversingUnderlyingEnumeratorItemsAtM
tokens.Advance().ShouldBeSameAs(tokens.Advance());
}
- [Fact]
public void ProvidesPositionOfCurrentToken()
{
var tokens = new TokenStream(Tokens());
View
9 src/Parsley.Test/ValueTests.cs
@@ -1,26 +1,22 @@
using Should;
-using Xunit;
namespace Parsley
{
public class ValueTests
{
- [Fact]
public void AnInstanceShouldAlwaysReturnTheSameHashCode()
{
var o = new Sample(1, "A");
o.GetHashCode().ShouldEqual(o.GetHashCode());
}
- [Fact]
public void HashCodesOfEquivalentObjectsShouldBeEqual()
{
var a = new Sample(1, "A");
var b = new Sample(1, "A");
a.GetHashCode().ShouldEqual(b.GetHashCode());
}
- [Fact]
public void HashCodesOfNonEquivalentObjectsShouldUsuallyBeDifferent()
{
var a = new Sample(0, "A");
@@ -31,19 +27,16 @@ public void HashCodesOfNonEquivalentObjectsShouldUsuallyBeDifferent()
b.GetHashCode().ShouldNotEqual(c.GetHashCode());
}
- [Fact]
public void HashCodesShouldBeSafeFromNullFields()
{
new Sample(0, null).GetHashCode();
}
- [Fact]
public void HashCodesShouldBeSafeFromNumericOverflow()
{
new Sample(int.MaxValue, "A").GetHashCode();
}
- [Fact]
public void IsEquatableByComparingImmutableFields()
{
var nil = (Sample)null;
@@ -54,7 +47,6 @@ public void IsEquatableByComparingImmutableFields()
new Sample(0, null).Equals(new Sample(0, "A")).ShouldBeFalse();
}
- [Fact]
public void OverridesObjectEquals()
{
object nil = null;
@@ -65,7 +57,6 @@ public void OverridesObjectEquals()
new Sample(0, null).Equals((object)new Sample(0, "A")).ShouldBeFalse();
}
- [Fact]
public void OverloadsEqualityOperators()
{
var a = new Sample(0, "A");
View
2 src/Parsley.Test/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="Fixie" version="0.0.1.24" targetFramework="net45" />
<package id="Should" version="1.1.12.0" />
- <package id="xunit" version="1.9.1" targetFramework="net40" />
</packages>
View
2 src/Parsley/Grammar.cs
@@ -7,7 +7,7 @@ namespace Parsley
{
public abstract class Grammar
{
- public void InferGrammarRuleNames()
+ protected void InferGrammarRuleNames()
{
const BindingFlags fieldBindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

0 comments on commit b836046

Please sign in to comment.
Something went wrong with that request. Please try again.