|
69 | 69 | proj = DataSets.load_project(config) |
70 | 70 | ds = dataset(proj, "a_text_file") |
71 | 71 | let s = sprint(show, "text/plain", ds) |
72 | | - parsed = TOML.parse(s) |
73 | | - @test parsed isa Dict |
74 | | - @test parsed["name"] == "a_text_file" |
75 | | - @test parsed["uuid"] == "b498f769-a7f6-4f67-8d74-40b770398f26" |
76 | | - @test parsed["foo"] == "<unserializable>" |
77 | | - @test parsed["bar"] == [1, 2, "<unserializable>", Dict("x" => "<unserializable>", "y" => "y")] |
78 | | - @test parsed["baz"] == Dict("x" => "<unserializable>", "y" => "y") |
| 72 | + # It looks like that in Julia <= 1.8.0, the TOML.print(f, ...) variant |
| 73 | + # for arbitrary types does not actually work, since it's missing the fallback |
| 74 | + # implementation and has other bugs, depending on the Julia version. |
| 75 | + # |
| 76 | + # So the `show()`-ed TOML will not parse again. But since we have a try-catch anyway, |
| 77 | + # we don't care too much, so we just run a simplified test in that case. |
| 78 | + if VERSION >= v"1.9.0" |
| 79 | + parsed = TOML.parse(s) |
| 80 | + @test parsed isa Dict |
| 81 | + @test parsed["name"] == "a_text_file" |
| 82 | + @test parsed["uuid"] == "b498f769-a7f6-4f67-8d74-40b770398f26" |
| 83 | + @test parsed["foo"] == "<unserializable>" |
| 84 | + @test parsed["bar"] == [1, 2, "<unserializable>", Dict("x" => "<unserializable>", "y" => "y")] |
| 85 | + @test parsed["baz"] == Dict("x" => "<unserializable>", "y" => "y") |
| 86 | + else |
| 87 | + @test occursin("<unserializable>", s) |
| 88 | + end |
79 | 89 | end |
80 | 90 |
|
81 | 91 | # Also test bad keys |
|
86 | 96 | proj = DataSets.load_project(config) |
87 | 97 | ds = dataset(proj, "a_text_file") |
88 | 98 | let s = sprint(show, "text/plain", ds) |
89 | | - endswith(s, "\n... <unserializable>") |
| 99 | + endswith(s, "\n... <unserializable>\nSet JULIA_DEBUG=DataSets to see the error") |
90 | 100 | end |
91 | 101 | end |
92 | 102 |
|
|
0 commit comments