| 1 | package memory |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | type queueContextProbe struct{} |
| 9 | |
| 10 | func (queueContextProbe) QueueMemory(string) {} |
| 11 | |
| 12 | func TestWithoutQueueShadowsAncestorQueue(t *testing.T) { |
| 13 | parent := WithQueue(context.Background(), queueContextProbe{}) |
| 14 | child := WithoutQueue(parent) |
| 15 | if _, ok := QueueFromContext(child); ok { |
| 16 | t.Fatal("child context inherited the parent memory queue") |
| 17 | } |
| 18 | if _, ok := QueueFromContext(parent); !ok { |
| 19 | t.Fatal("parent memory queue was lost") |
| 20 | } |
| 21 | } |
| 22 |