File: cmp_test.go

package info (click to toggle)
elvish 0.21.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,372 kB
  • sloc: javascript: 236; sh: 130; python: 104; makefile: 88; xml: 9
file content (27 lines) | stat: -rw-r--r-- 719 bytes parent folder | download
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
package vals

import (
	"testing"

	"src.elv.sh/pkg/tt"
)

func TestCmp(t *testing.T) {
	// Cmp is tested by tests of the Elvish compare command.
}

func TestCmpTotal_StructMap(t *testing.T) {
	// CmpTotal should pretend that structmaps are maps too. Since maps don't
	// have an internal ordering, comparing a structmap to another structmap or
	// to a map should always return CmpEqual, like comparing two maps.
	//
	// This is not covered by tests of the Elvish compare command because Elvish
	// code are not supposed to know which values are actually structmaps.
	x := testStructMap{}
	y := testStructMap2{}
	z := EmptyMap
	tt.Test(t, CmpTotal,
		tt.Args(x, y).Rets(CmpEqual),
		tt.Args(x, z).Rets(CmpEqual),
	)
}