public void TestStandAloneOptionTokenConstruction() { Name name = new Name("option", "alt1", "alt2"); var token = new StandAloneOptionToken(name); Assert.Same(name, token.Name); Assert.Equal("(option|alt1|alt2)", token.DisplayName); Assert.True(token.IsOptional); Assert.Equal(TokenKind.StandAloneOption, token.Kind); }
[InlineData(new [] { "a", "b", "c", "d" }, 0, false, 0)] //No match public void TestStandAloneOptionMatches(string[] input, int startIdx, bool expMatches, int expMatchLength) { var token = new StandAloneOptionToken(new Name("option", "alt1", "alt2")); TokenMatchResult matchResult = token.Matches(input, startIdx); if (expMatches) { Assert.True(matchResult.MatchOutcome == MatchOutcome.Full, $"Failed in case \"{input}\""); } else { Assert.False(matchResult.MatchOutcome == MatchOutcome.Full, $"Failed in case \"{input}\""); } Assert.Equal(expMatchLength, matchResult.TokensMatched); }