MCPcopy Create free account
hub / github.com/google/gapid / Equals

Method Equals

core/assert/string.go:45–67  ·  view source on GitHub ↗

Equals asserts that the supplied string is equal to the expected string.

(expect string)

Source from the content-addressed store, hash-verified

43
44// Equals asserts that the supplied string is equal to the expected string.
45func (o OnString) Equals(expect string) bool {
46 return o.Compare(o.value, "==", expect).Test(func() bool {
47 if o.value == expect {
48 return true
49 }
50 re := ([]rune)(expect)
51 for i, c := range o.value {
52 if i >= len(re) {
53 o.Printf("Longer\tby\t")
54 o.Println(o.value[i:])
55 return false
56 }
57 if c != re[i] {
58 o.Printf("Differs\tfrom\t")
59 o.Println(o.value[i:])
60 return false
61 }
62 }
63 o.Printf("Shorter\tby\t")
64 o.Println(expect[len(o.value):])
65 return false
66 }())
67}
68
69// NotEquals asserts that the supplied string is not equal to the test string.
70func (o OnString) NotEquals(test string) bool {

Callers

nothing calls this directly

Calls 4

TestMethod · 0.80
CompareMethod · 0.45
PrintfMethod · 0.45
PrintlnMethod · 0.45

Tested by

no test coverage detected