v0.1.1 decode hardening, round trip support, doc and test update
Test / test (push) Canceled after 0s
Test / test (push) Canceled after 0s
This commit is contained in:
15 files changed
+874
-651
No files matched your search
+6
-5
@@ -62,7 +62,8 @@ func TestDecode_DeepPointers(t *testing.T) {
|
||||
|
||||
func TestDecode_LargeIntPrecision(t *testing.T) {
|
||||
largeVal := int64(4611686018427387905)
|
||||
data := map[string]any{"id": int(largeVal)}
|
||||
// Keep the source value intact on 32-bit platforms too.
|
||||
data := map[string]any{"id": largeVal}
|
||||
|
||||
type T struct {
|
||||
ID int64 `toml:"id"`
|
||||
@@ -191,11 +192,11 @@ mid_val = 2
|
||||
}
|
||||
|
||||
a := res["a"].(map[string]any)
|
||||
if a["root_val"] != 1 {
|
||||
if a["root_val"] != int64(1) {
|
||||
t.Errorf("Missing root_val: %v", a["root_val"])
|
||||
}
|
||||
b := a["b"].(map[string]any)
|
||||
if b["mid_val"] != 2 {
|
||||
if b["mid_val"] != int64(2) {
|
||||
t.Errorf("Missing mid_val: %v", b["mid_val"])
|
||||
}
|
||||
}
|
||||
@@ -384,7 +385,7 @@ i = 5
|
||||
|
||||
a := res["a"].(map[string]any)
|
||||
b := a["b"].(map[string]any)
|
||||
if b["i"] != 5 {
|
||||
if b["i"] != int64(5) {
|
||||
t.Errorf("Value 'i' lost in table reentry. Got %v", b["i"])
|
||||
}
|
||||
if _, ok := b["c"].(map[string]any); !ok {
|
||||
@@ -514,4 +515,4 @@ func TestParser_KeyValueContext(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Error("Float key should have been rejected")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user