...

Source file src/github.com/docker/distribution/context/version_test.go

Documentation: github.com/docker/distribution/context

     1  package context
     2  
     3  import "testing"
     4  
     5  func TestVersionContext(t *testing.T) {
     6  	ctx := Background()
     7  
     8  	if GetVersion(ctx) != "" {
     9  		t.Fatalf("context should not yet have a version")
    10  	}
    11  
    12  	expected := "2.1-whatever"
    13  	ctx = WithVersion(ctx, expected)
    14  	version := GetVersion(ctx)
    15  
    16  	if version != expected {
    17  		t.Fatalf("version was not set: %q != %q", version, expected)
    18  	}
    19  }
    20  

View as plain text