File: spec_test.go

package info (click to toggle)
golang-ariga-atlas 0.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,676 kB
  • sloc: javascript: 592; sql: 404; makefile: 10
file content (33 lines) | stat: -rw-r--r-- 704 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
28
29
30
31
32
33
// Copyright 2021-present The Atlas Authors. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.

package schemahcl

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestBoolVal(t *testing.T) {
	b, err := BoolVal(&LiteralValue{V: "true"})
	require.NoError(t, err)
	require.True(t, b)
}

func TestBools(t *testing.T) {
	a := Attr{
		K: "b",
		V: &ListValue{
			V: []Value{
				&LiteralValue{V: "true"},
				&LiteralValue{V: "false"},
				&LiteralValue{V: "true"},
			},
		},
	}
	bls, err := a.Bools()
	require.NoError(t, err)
	require.EqualValues(t, []bool{true, false, true}, bls)
}