gtest

package
v0.0.0-...-afa323b Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0, MIT Imports: 3 Imported by: 3

Documentation

Overview

Package gtest contains helpers for running google-test tests from Go.

Index

Constants

This section is empty.

Variables

View Source
var (

	// TestFlags is the flags that are set for all tests.
	TestFlags = []string{}
)

Functions

func BuildTestArgs

func BuildTestArgs(indices []int, testCases []TestCase) []string

BuildTestArgs builds arguments to be passed to the test binary to execute only the test cases in `indices`.

Types

type TestCase

type TestCase struct {
	// Suite is the suite for this test.
	Suite string

	// Name is the name of this individual test.
	Name string
	// contains filtered or unexported fields
}

TestCase is a single gtest test case.

func ParseBenchmarks

func ParseBenchmarks(binary string, extraArgs ...string) ([]TestCase, error)

ParseBenchmarks returns each benchmark in the binary's list as a single test case.

func ParseTestCases

func ParseTestCases(testBin string, benchmarks bool, extraArgs ...string) ([]TestCase, error)

ParseTestCases calls a gtest test binary to list its test and returns a slice with the name and suite of each test.

If benchmarks is true, then benchmarks will be included in the list of test cases provided. Note that this requires the binary to support the benchmarks_list_tests flag.

func (TestCase) Args

func (tc TestCase) Args() []string

Args returns arguments to be passed when invoking the test.

func (TestCase) FullName

func (tc TestCase) FullName() string

FullName returns the name of the test including the suite. It is suitable to pass to "-gtest_filter".

Jump to

Keyboard shortcuts

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