From 4f8f13fd76f065e49efdb3aa1a7504ffcafbf9a8 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Wed, 19 May 2021 00:49:33 +0200 Subject: Allow setting branch (#46) Support specifying the branch from which source will be served in the YAML configuration. --- config_test.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'config_test.go') diff --git a/config_test.go b/config_test.go index bf64085..e87954b 100644 --- a/config_test.go +++ b/config_test.go @@ -15,6 +15,7 @@ url: google.golang.org packages: grpc: repo: github.com/grpc/grpc-go + branch: main `) defer clean() @@ -28,7 +29,26 @@ packages: pkg, ok := config.Packages["grpc"] assert.True(t, ok) - assert.Equal(t, pkg, Package{Repo: "github.com/grpc/grpc-go"}) + assert.Equal(t, pkg, Package{Repo: "github.com/grpc/grpc-go", Branch: "main"}) +} + +func TestParseDefaultBranch(t *testing.T) { + path, clean := TempFile(t, ` + +url: google.golang.org +packages: + grpc: + repo: github.com/grpc/grpc-go + +`) + defer clean() + + config, err := Parse(path) + assert.NoError(t, err) + + pkg, ok := config.Packages["grpc"] + assert.True(t, ok) + assert.Equal(t, pkg, Package{Repo: "github.com/grpc/grpc-go", Branch: "master"}) } func TestParseGodocServer(t *testing.T) { @@ -62,7 +82,7 @@ packages: pkg, ok := config.Packages["grpc"] assert.True(t, ok) - assert.Equal(t, Package{Repo: "github.com/grpc/grpc-go"}, pkg) + assert.Equal(t, Package{Repo: "github.com/grpc/grpc-go", Branch: "master"}, pkg) }) } } -- cgit v1.2.3