| 1170 | } |
| 1171 | |
| 1172 | func TestSetArrayNonLeaf(t *testing.T) { |
| 1173 | branch := TreeBranch{ |
| 1174 | TreeItem{ |
| 1175 | Key: "array", |
| 1176 | Value: []interface{}{ |
| 1177 | 1, |
| 1178 | }, |
| 1179 | }, |
| 1180 | } |
| 1181 | set, changed := branch.Set([]interface{}{"array", 0, "hello"}, "hello") |
| 1182 | assert.Equal(t, true, changed) |
| 1183 | assert.Equal(t, TreeBranch{ |
| 1184 | TreeItem{ |
| 1185 | Key: "array", |
| 1186 | Value: []interface{}{ |
| 1187 | TreeBranch{ |
| 1188 | TreeItem{ |
| 1189 | Key: "hello", |
| 1190 | Value: "hello", |
| 1191 | }, |
| 1192 | }, |
| 1193 | }, |
| 1194 | }, |
| 1195 | }, set) |
| 1196 | } |
| 1197 | |
| 1198 | func TestUnsetKeyRootLeaf(t *testing.T) { |
| 1199 | branch := TreeBranch{ |