(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestFixedArraysNotLimited(t *testing.T) { |
| 104 | // Test that fixed arrays are not subject to limits |
| 105 | // BigArray [1000]int should work even though 1000 > 100 (array limit) |
| 106 | data := UnlimitedData{} |
| 107 | |
| 108 | t.Run("FixedArray_DecodeMsg", func(t *testing.T) { |
| 109 | buf := msgp.AppendMapHeader(nil, 1) |
| 110 | buf = msgp.AppendString(buf, "big_array") |
| 111 | buf = msgp.AppendArrayHeader(buf, 1000) // Fixed array size, should not be limited |
| 112 | for i := 0; i < 1000; i++ { |
| 113 | buf = msgp.AppendInt(buf, i) |
| 114 | } |
| 115 | |
| 116 | reader := msgp.NewReader(bytes.NewReader(buf)) |
| 117 | err := data.DecodeMsg(reader) |
| 118 | if err != nil { |
| 119 | t.Errorf("Fixed arrays should not be limited, got error: %v", err) |
| 120 | } |
| 121 | }) |
| 122 | |
| 123 | t.Run("FixedArray_UnmarshalMsg", func(t *testing.T) { |
| 124 | buf := msgp.AppendMapHeader(nil, 1) |
| 125 | buf = msgp.AppendString(buf, "big_array") |
| 126 | buf = msgp.AppendArrayHeader(buf, 1000) // Fixed array size, should not be limited |
| 127 | for i := 0; i < 1000; i++ { |
| 128 | buf = msgp.AppendInt(buf, i) |
| 129 | } |
| 130 | |
| 131 | _, err := data.UnmarshalMsg(buf) |
| 132 | if err != nil { |
| 133 | t.Errorf("Fixed arrays should not be limited, got error: %v", err) |
| 134 | } |
| 135 | }) |
| 136 | } |
| 137 | |
| 138 | func TestSliceLimitsApplied(t *testing.T) { |
| 139 | // Test that dynamic slices are subject to limits |
nothing calls this directly
no test coverage detected
searching dependent graphs…