2023-10-24 17:16:58 +00:00
|
|
|
package dcontext
|
2015-09-11 03:41:58 +00: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)
|
|
|
|
}
|
|
|
|
}
|