add test for comment in dictionary from #145

check that we correctly handle the case where a comment appears inside a dictionary, this was handled by commit 3084a9. use list internally to dictionary tokenizer to avoid interface performance penalties.
This commit is contained in:
Eliot Jones
2020-03-03 11:36:01 +00:00
parent 14599521f5
commit 4b5c8d510e
2 changed files with 34 additions and 1 deletions

View File

@@ -193,6 +193,39 @@ endobj
Assert.Equal(4, mediaBox.Length);
}
[Fact]
public void CommentsInsideDictionaryFromSap()
{
const string s = @"<<
/Author (ABCD )
/CreationDate (D:20150505083655)
/Creator (Form 2014 EN)
/Producer (SAP NetWeaver 700 )
%SAPinfoStart TOA_DARA
%FUNCTION=( )
%MANDANT=( )
%DEL_DATE=( )
%SAP_OBJECT=( )
%AR_OBJECT=( )
%OBJECT_ID=( )
%FORM_ID=( )
%FORMARCHIV=( )
%RESERVE=( )
%NOTIZ=( )
%-( )
%-( )
%-( )
%SAPinfoEnd TOA_DARA
>>";
var input = StringBytesTestConverter.Convert(s);
Assert.True(tokenizer.TryTokenize(input.First, input.Bytes, out var token));
var dictionary = AssertDictionaryToken(token);
AssertDictionaryEntry<StringToken, string>(dictionary, NameToken.Producer, "SAP NetWeaver 700 ");
}
private static void AssertDictionaryEntry<TValue, TValueData>(DictionaryToken dictionary, NameToken key,
TValueData value) where TValue : IDataToken<TValueData>

View File

@@ -60,7 +60,7 @@
return true;
}
private static Dictionary<NameToken, IToken> ConvertToDictionary(IReadOnlyList<IToken> tokens)
private static Dictionary<NameToken, IToken> ConvertToDictionary(List<IToken> tokens)
{
var result = new Dictionary<NameToken, IToken>();