File: error_test.go

package info (click to toggle)
golang-github-aws-aws-sdk-go-v2 1.24.1-2~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 554,032 kB
  • sloc: java: 15,941; makefile: 419; sh: 175
file content (52 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (7)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//go:build go1.7
// +build go1.7

package expression

import (
	"testing"
)

func TestInvalidParameterError(t *testing.T) {
	cases := []struct {
		name     string
		input    InvalidParameterError
		expected string
	}{
		{
			name:     "invalid error",
			input:    newInvalidParameterError("func", "param"),
			expected: "func error: invalid parameter: param",
		},
	}
	for _, c := range cases {
		t.Run(c.name, func(t *testing.T) {
			actual := c.input.Error()
			if e, a := c.expected, actual; e != a {
				t.Errorf("expect %v, got %v", e, a)
			}
		})
	}
}

func TestUnsetParameterError(t *testing.T) {
	cases := []struct {
		name     string
		input    UnsetParameterError
		expected string
	}{
		{
			name:     "unset error",
			input:    newUnsetParameterError("func", "param"),
			expected: "func error: unset parameter: param",
		},
	}
	for _, c := range cases {
		t.Run(c.name, func(t *testing.T) {
			actual := c.input.Error()
			if e, a := c.expected, actual; e != a {
				t.Errorf("expect %v, got %v", e, a)
			}
		})
	}
}