golang.org/x/arch@v0.17.0/internal/unify/value_test.go (about)

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package unify
     6  
     7  import "slices"
     8  
     9  func ExampleClosure_All_tuple() {
    10  	v := mustParse(`
    11  - !sum [1, 2]
    12  - !sum [3, 4]
    13  `)
    14  	printYaml(slices.Collect(v.All()))
    15  
    16  	// Output:
    17  	// - [1, 3]
    18  	// - [1, 4]
    19  	// - [2, 3]
    20  	// - [2, 4]
    21  }
    22  
    23  func ExampleClosure_All_def() {
    24  	v := mustParse(`
    25  a: !sum [1, 2]
    26  b: !sum [3, 4]
    27  c: 5
    28  `)
    29  	printYaml(slices.Collect(v.All()))
    30  
    31  	// Output:
    32  	// - {a: 1, b: 3, c: 5}
    33  	// - {a: 1, b: 4, c: 5}
    34  	// - {a: 2, b: 3, c: 5}
    35  	// - {a: 2, b: 4, c: 5}
    36  }