public void MoveNext_should_allow_special_identifiers(string text) { var s = new SignatureParser.Scanner(text); Assert.True(s.MoveNext()); Assert.Equal(TokenType.Identifier, s.Type); Assert.Equal(text, s.Value); Assert.True(s.MoveNext()); Assert.Equal(TokenType.EndOfInput, s.Type); }
internal void Value_should_yield_correct_types(TokenType type, string text) { // NB: method is internal due to TokenType being internal var s = new SignatureParser.Scanner(text); Assert.True(s.MoveNext()); Assert.Equal(type, s.Type); Assert.Equal(text, s.Value); Assert.True(s.MoveNext()); Assert.Equal(TokenType.EndOfInput, s.Type); }
public void Type_should_return_Error_on_invalid_generics(string text) { var s = new SignatureParser.Scanner(text); Assert.True(s.MoveNext()); Assert.Equal(TokenType.Error, s.Type); }
internal void Value_should_yield_ws_correct_types(string text) { var s = new SignatureParser.Scanner(text); Assert.True(s.MoveNext()); Assert.Equal(TokenType.Space, s.Type); Assert.Equal(" ", s.Value); // always collapse }
public void PushBack_should_yield_extra_token() { var s = new SignatureParser.Scanner("[]"); Assert.True(s.MoveNext()); Assert.Equal("[", s.Value); s.PushBack(); Assert.True(s.MoveNext()); Assert.Equal("[", s.Value); Assert.True(s.MoveNext()); Assert.Equal("]", s.Value); Assert.True(s.MoveNext()); Assert.Null(s.Value); Assert.False(s.MoveNext()); }
public void Current_should_yield_generic_correct_types(string text, bool method, int position) { var s = new SignatureParser.Scanner(text); Assert.True(s.MoveNext()); Assert.Equal(TokenType.GenericPosition, s.Type); var token = (SignatureParser.GenericPositionToken)s.Current; Assert.Equal(method, token.IsMethod); Assert.Equal(position, token.Position); }