示例#1
0
 public void TokensWithTheSameTypeAreAlwaysTheSame()
 {
     Assert.That(DefinitionToken.Close, Is.EqualTo(DefinitionToken.Close));
     Assert.That(DefinitionToken.FromIdentifier("abc"),
                 Is.EqualTo(DefinitionToken.FromIdentifier("abc")));
     Assert.That(DefinitionToken.FromNumber("123"),
                 Is.EqualTo(DefinitionToken.FromNumber(123)));
 }
示例#2
0
 public void CheckTokenType()
 {
     Assert.That(DefinitionToken.Open.IsIdentifier, Is.False);
     Assert.That(DefinitionToken.Open.IsNumber, Is.False);
     Assert.That(DefinitionToken.Close.IsText, Is.False);
     Assert.That(DefinitionToken.FromIdentifier(nameof(CheckTokenType)).IsIdentifier, Is.True);
     Assert.That(DefinitionToken.FromNumber(5).IsNumber, Is.True);
     Assert.That(DefinitionToken.FromText(nameof(TokenTests)).IsText, Is.True);
 }
示例#3
0
        public void FindSingleToken()
        {
            CheckSingleToken("	test(", DefinitionToken.Open);
            CheckSingleToken("	test(number)", DefinitionToken.Close);

            /*unused
             * CheckSingleToken("	is", DefinitionToken.Is);
             * CheckSingleToken("	test", DefinitionToken.Test);
             */
            CheckSingleToken("	53", DefinitionToken.FromNumber(53));
            CheckSingleToken("	number", DefinitionToken.FromIdentifier("number"));
        }
示例#4
0
 public void TokenToString()
 {
     Assert.That(DefinitionToken.Open.ToString(), Is.EqualTo("("));
     Assert.That(DefinitionToken.FromNumber(123).ToString(), Is.EqualTo("123"));
     Assert.That(DefinitionToken.FromIdentifier("Hello").ToString(), Is.EqualTo("Hello"));
 }