Skip to content

Commit

Permalink
Fix flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
Drvi committed Nov 10, 2023
1 parent 67128b9 commit bced6af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,15 @@ end
@testset "initial_lex!" begin
lexer = NewlineLexers.Lexer(IOBuffer("1"), nothing, UInt8('\n'))
ctx = ChunkingContext(4, 1, 0, nothing)
ctx.bytes .= false
@assert lexer.done == false
@assert ctx.newline_positions == [0]
ChunkedBase.initial_lex!(lexer, ctx, 0)
@test ctx.newline_positions == [0]

lexer = NewlineLexers.Lexer(IOBuffer("1"), nothing, UInt8('\n'))
ctx = ChunkingContext(4, 1, 0, nothing)
ctx.bytes .= false
@assert lexer.done == false
@assert ctx.newline_positions == [0]
seekend(lexer.io)
Expand All @@ -489,13 +491,15 @@ end

lexer = NewlineLexers.Lexer(IOBuffer("1"), nothing, UInt8('\n'))
ctx = ChunkingContext(4, 1, 0, nothing)
ctx.bytes .= false
ctx.newline_positions.elements[1] = 1
@test_throws AssertionError ChunkedBase.initial_lex!(lexer, ctx, 0)
@test_throws AssertionError ChunkedBase.initial_lex!(lexer, ctx, 5)

lexer = NewlineLexers.Lexer(IOBuffer("1"), nothing, UInt8('\n'))
lexer.done = true
ctx = ChunkingContext(4, 1, 0, nothing)
ctx.bytes .= false
@test_throws AssertionError ChunkedBase.initial_lex!(lexer, ctx, 0)
@test_throws AssertionError ChunkedBase.initial_lex!(lexer, ctx, 5)

Expand Down

0 comments on commit bced6af

Please sign in to comment.