MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestMatch_Alias

Function TestMatch_Alias

match_test.go:79–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestMatch_Alias(t *testing.T) {
80 reporter := newMockReporter(t)
81
82 matches := []string{"m0", "m1", "m2"}
83 names := []string{"", "n1", "n2"}
84
85 value := NewMatch(reporter, matches, names)
86 assert.Equal(t, []string{"Match()"}, value.chain.context.Path)
87 assert.Equal(t, []string{"Match()"}, value.chain.context.AliasedPath)
88
89 value.Alias("foo")
90 assert.Equal(t, []string{"Match()"}, value.chain.context.Path)
91 assert.Equal(t, []string{"foo"}, value.chain.context.AliasedPath)
92
93 childValue := value.Submatch(0)
94 assert.Equal(t, []string{"Match()", "Submatch(0)"}, childValue.chain.context.Path)
95 assert.Equal(t, []string{"foo", "Submatch(0)"}, childValue.chain.context.AliasedPath)
96}
97
98func TestMatch_Getters(t *testing.T) {
99 matches := []string{"m0", "m1", "m2"}

Callers

nothing calls this directly

Calls 5

AliasMethod · 0.95
SubmatchMethod · 0.95
newMockReporterFunction · 0.85
NewMatchFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…