-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
samples verify block by block #88
Conversation
50fbfd3
to
fb4ae04
Compare
a04ce68
to
e7a2e46
Compare
src/main/java/org/biscuitsec/biscuit/token/builder/parser/Parser.java
Outdated
Show resolved
Hide resolved
src/main/java/org/biscuitsec/biscuit/token/builder/parser/Parser.java
Outdated
Show resolved
Hide resolved
src/main/java/org/biscuitsec/biscuit/token/builder/parser/Parser.java
Outdated
Show resolved
Hide resolved
src/main/java/org/biscuitsec/biscuit/token/builder/parser/Parser.java
Outdated
Show resolved
Hide resolved
src/test/java/org/biscuitsec/biscuit/builder/parser/ParserTest.java
Outdated
Show resolved
Hide resolved
SymbolTable sampleSymbols = new SymbolTable(sampleBlock.symbols); | ||
|
||
Either<Map<Integer, List<org.biscuitsec.biscuit.token.builder.parser.Error>>, org.biscuitsec.biscuit.token.builder.Block> outputSample = Parser.datalog(sampleBlockIndex, baseSymbols, sampleDatalog); | ||
assertTrue(outputSample.isRight()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should show the input that was parsed and the error we got, otherwise we don't have any context to fix it
System.out.println(outputSample.get().build().print(sampleSymbols)); | ||
System.out.println(block.symbols.symbols); | ||
System.out.println(block.print(sampleSymbols)); | ||
assertArrayEquals(outputSample.get().build().to_bytes().get(), block.to_bytes().get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, this should show the expected and actual arrays, because the errors don't help https://github.com/biscuit-auth/biscuit-java/actions/runs/8622173639/job/23632740026?pr=88#step:5:6259
BTW is there a good way in maven to capture stdout in tests, so that we only display it for tests that failed? |
Co-authored-by: Aurélien Mino <[email protected]>
Co-authored-by: Aurélien Mino <[email protected]>
#94 merges the parts of this PR that were already usable, leaving the samples block checks and the Right now I am not too convinced about the implementation of that method that does manual string manipulations. An implementation that follows the rest of the parser, using parser combinators, would fit better here and prevent errors. |
closing this since it has been merged as part of #102 |
This is DRAFT.