Closed FedorChervyakov closed 2 years ago
This looks to be headed in a decent direction. It does make me wonder though if we should just take a different approach all together w/ pretty printing and parse the input as a JSON3.Object
first and then recursively print it out in a pretty way. That would preserve the ordering and probably end up being a simple implementation. But it's been long enough since I wrote this that I may have already tried that and it didn't work for some other reason.
This looks to be headed in a decent direction. It does make me wonder though if we should just take a different approach all together w/ pretty printing and parse the input as a
JSON3.Object
first and then recursively print it out in a pretty way. That would preserve the ordering and probably end up being a simple implementation. But it's been long enough since I wrote this that I may have already tried that and it didn't work for some other reason.
Cool, it does make sense to parse as JSON3.Object
first, I'll try to rewrite pretty
using this approach.
Merging #195 (06040bd) into main (da3ca85) will decrease coverage by
0.04%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #195 +/- ##
==========================================
- Coverage 88.83% 88.78% -0.05%
==========================================
Files 9 9
Lines 1693 1650 -43
==========================================
- Hits 1504 1465 -39
+ Misses 189 185 -4
Impacted Files | Coverage Δ | |
---|---|---|
src/pretty.jl | 91.83% <100.00%> (+0.53%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update da3ca85...06040bd. Read the comment docs.
Fixes #192.
In this PR we rewrite the
pretty
function to parse the input as aJSON3.Object
and add a couple of tests for thepretty
function.By parsing the input string as
JSON3.Object
and passing it recursively topretty
, we preserve field ordering.New tests check that ordering of nested structs and NamedTuples is preserved. Also, this PR wraps tests related to
pretty
inpretty.jl
testset.