package pdf import ( "io" "testing" ) func TestCommentState(t *testing.T) { tests := []struct { name string input string expectedState state expectedError error expectTokens []tokenInterface }{ {"This is a comment", "% This is a comment", commentState{}, io.EOF, []tokenInterface{&commentToken{}}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tok := createTestTokenizerWithData(tt.input) tok.state = commentState{ token: &commentToken{}, } // Verarbeite den Tokenizer tok.state.process(tok) checkStateAgainstDef(t, tok, tt.expectedState) checkErrors(t, tok, tt.expectedError) checkTokenStack(t, tok, tt.expectTokens) }) } }