mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-19 19:07:56 +08:00
add plain tokenizer tests for uncovered lines and add editorconfig
This commit is contained in:
2
src/.editorconfig
Normal file
2
src/.editorconfig
Normal file
@@ -0,0 +1,2 @@
|
||||
root = true
|
||||
[*.cs]
|
@@ -0,0 +1,35 @@
|
||||
namespace UglyToad.PdfPig.Tests.Tokenization
|
||||
{
|
||||
using PdfPig.Tokenization;
|
||||
using PdfPig.Tokenization.Tokens;
|
||||
using Xunit;
|
||||
|
||||
public class PlainTokenizerTests
|
||||
{
|
||||
private readonly PlainTokenizer tokenizer = new PlainTokenizer();
|
||||
|
||||
[Fact]
|
||||
public void TextNullReturnsNullToken()
|
||||
{
|
||||
var input = StringBytesTestConverter.Convert("null ");
|
||||
|
||||
var result = tokenizer.TryTokenize(input.First, input.Bytes, out var token);
|
||||
|
||||
Assert.True(result);
|
||||
|
||||
Assert.Equal(NullToken.Instance, token);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryTokenizeWhitespaceFalse()
|
||||
{
|
||||
var input = StringBytesTestConverter.Convert(" something");
|
||||
|
||||
var result = tokenizer.TryTokenize(input.First, input.Bytes, out var token);
|
||||
|
||||
Assert.False(result);
|
||||
|
||||
Assert.Null(token);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UglyToad.PdfPig", "UglyToad
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UglyToad.PdfPig.Tests", "UglyToad.PdfPig.Tests\UglyToad.PdfPig.Tests.csproj", "{5BA09F66-5706-4637-B083-E1DC4D53289B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C55738D2-3165-4D03-9CE2-10A2E2EEC465}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
Reference in New Issue
Block a user