2023-10-24 13:16:58 -04:00
|
|
|
package dcontext
|
2015-09-10 20:41:58 -07:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestVersionContext(t *testing.T) {
|
|
|
|
ctx := Background()
|
|
|
|
|
|
|
|
if GetVersion(ctx) != "" {
|
|
|
|
t.Fatalf("context should not yet have a version")
|
|
|
|
}
|
|
|
|
|
|
|
|
expected := "2.1-whatever"
|
|
|
|
ctx = WithVersion(ctx, expected)
|
|
|
|
version := GetVersion(ctx)
|
|
|
|
|
|
|
|
if version != expected {
|
|
|
|
t.Fatalf("version was not set: %q != %q", version, expected)
|
|
|
|
}
|
|
|
|
}
|