Implement a package that provides context management functionality in Go, specifically focusing on creating a Ctx type with cancellation and timeout capabilities.
Requirements:
Context Structure:
Define a struct named Ctx in the /app/ directory to represent a context.
WithCancel Method:
Implement a method WithCancel() for the Ctx type that returns:
A new Ctx instance.
A cancel function that can be called to cancel the context.
When cancel() is called, the context should be marked as done, and the channel <-ctx.Done() should signal this.
WithTimeout Method:
Implement a method WithTimeout(duration time.Duration) for the Ctx type that returns:
A new Ctx instance.
This method should set a timeout for the context using a goroutine that waits for the specified duration before marking the context as done.
After the timeout duration has elapsed, the channel <-ctx.Done() should signal that the context is done.
Testing:
The implementation must satisfy the provided tests TestCtxCancel and TestCtxTimeout by ensuring the context behaves as expected in both cancel and timeout scenarios.
The final implementation should correctly handle the cancellation and timeout, thus making the tests pass.
Important: declare your solution in package dsl (the test file uses package dsl, so the implementation must use the matching package name).