bufmoduletesting

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestDigest is a valid digest.
	//
	// This matches TestData.
	TestDigest = "b1-gLO3B_5ClhdU52w1gMOxk4GokvCoM1OqjarxMfjStGQ="
	// TestDigestB3WithConfiguration is a valid digest.
	//
	// This matches TestDataWithConfiguration.
	TestDigestB3WithConfiguration = "b3-b2gkRgE1WxTKpEfsK4ql8STGxqc6nRimCeMBGB5i2OU="
	// TestDigestWithDocumentation is a valid test digest.
	//
	// This matches TestDataWithDocumentation.
	TestDigestWithDocumentation = "b1-Vqi49Lw-sr3tTLQVwSJrRJnJSwV0yeg97ea957z02B0="
	// TestModuleReferenceFooBarV1String is a valid module reference string.
	TestModuleReferenceFooBarV1String = "buf.build/foob/bar:v1"
	// TestModuleReferenceFooBarV2String is a valid module reference string.
	TestModuleReferenceFooBarV2String = "buf.build/foob/bar:v2"
	// TestModuleReferenceFooBazV1String is a valid module reference string.
	TestModuleReferenceFooBazV1String = "buf.build/foob/baz:v1"
	// TestModuleReferenceFooBazV2String is a valid module reference string.
	TestModuleReferenceFooBazV2String = "buf.build/foob/baz:v2"
	// TestModuleDocumentation is a markdown module documentation file.
	TestModuleDocumentation = "# Module Documentation"
	// TestModuleConfiguration is a configuration file with an arbitrary module name,
	// and example lint and breaking configuration that covers every key. At least two
	// items are included in every key (where applicable) so that we validate whether
	// or not the digest is deterministic.
	TestModuleConfiguration = `` /* 837-byte string literal not displayed */

)

Variables

View Source
var (
	// TestData is the data that maps to TestDigest with TestModuleReferenceString.
	TestData = map[string][]byte{
		TestFile1Path: []byte(`syntax="proto3";`),
		TestFile2Path: []byte(`syntax="proto3";`),
	}
	//TestDataProto is the proto representation of TestData.
	TestDataProto = &modulev1alpha1.Module{
		Files: []*modulev1alpha1.ModuleFile{
			{
				Path:    TestFile1Path,
				Content: []byte(`syntax="proto3";`),
			},
			{
				Path:    TestFile2Path,
				Content: []byte(`syntax="proto3";`),
			},
		},
		BreakingConfig: &breakingv1.Config{Version: "v1beta1"},
		LintConfig:     &lintv1.Config{Version: "v1beta1"},
	}
	// TestDataWithDocumentation is the data that maps to TestDigestWithDocumentation.
	//
	// It includes a buf.md file.
	TestDataWithDocumentation = map[string][]byte{
		TestFile1Path: []byte(`syntax="proto3";`),
		"buf.md":      []byte(TestModuleDocumentation),
	}
	// TestDataWithDocumentationProto is the proto representation of TestDataWithDocumentation.
	TestDataWithDocumentationProto = &modulev1alpha1.Module{
		Files: []*modulev1alpha1.ModuleFile{
			{
				Path:    TestFile1Path,
				Content: []byte(`syntax="proto3";`),
			},
		},
		Documentation:  TestModuleDocumentation,
		BreakingConfig: &breakingv1.Config{Version: "v1beta1"},
		LintConfig:     &lintv1.Config{Version: "v1beta1"},
	}
	// TestDataWithConfiguration is the data that maps to TestDigestWithConfiguration.
	//
	// It includes a buf.yaml and a buf.md file.
	TestDataWithConfiguration = map[string][]byte{
		TestFile1Path: []byte(`syntax="proto3";`),
		TestFile2Path: []byte(`syntax="proto3";`),
		"buf.yaml":    []byte(TestModuleConfiguration),
		"buf.md":      []byte(TestModuleDocumentation),
	}
	// TestFile1Path is the path of file1.proto.
	TestFile1Path = "file1.proto"
	// TestFile2Path is the path of file2.proto.
	TestFile2Path = "folder/file2.proto"
	// TestCommit is a valid commit.
	TestCommit string
	// TestModuleReferenceFooBarCommitString is a valid module reference string.
	TestModuleReferenceFooBarCommitString string
	// TestModuleReferenceFooBazCommitString is a valid module reference string.
	TestModuleReferenceFooBazCommitString string
)

Functions

func NewFileInfo

func NewFileInfo(
	t *testing.T,
	path string,
	externalPath string,
	isImport bool,
	moduleIdentity bufmoduleref.ModuleIdentity,
	commit string,
) bufmoduleref.FileInfo

NewFileInfo returns a new FileInfo for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL