File: defaulting_test.go

package info (click to toggle)
gitlab-agent 16.1.3-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 6,324 kB
  • sloc: makefile: 175; sh: 52; ruby: 3
file content (25 lines) | stat: -rw-r--r-- 461 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package prototool

import (
	"testing"

	"github.com/stretchr/testify/assert"
	"google.golang.org/protobuf/types/known/durationpb"
)

func TestNotNil(t *testing.T) {
	var x struct {
		Bla *durationpb.Duration // an example proto field
	}
	NotNil(&x.Bla)
	assert.NotNil(t, x.Bla)
}

func TestStringPtr(t *testing.T) {
	var x struct {
		Bla *string // an example proto field
	}
	StringPtr(&x.Bla, "foo")
	assert.NotNil(t, x.Bla)
	assert.Equal(t, "foo", *x.Bla)
}