github.com/blend/go-sdk@v1.20220411.3/profanity/config_test.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package profanity 9 10 import ( 11 "testing" 12 13 "github.com/blend/go-sdk/assert" 14 "github.com/blend/go-sdk/ref" 15 ) 16 17 func TestConfig(t *testing.T) { 18 assert := assert.New(t) 19 20 cfg := Config{} 21 assert.False(cfg.DebugOrDefault()) 22 cfg.Debug = ref.Bool(true) 23 assert.True(cfg.DebugOrDefault()) 24 25 assert.False(cfg.VerboseOrDefault()) 26 cfg.Verbose = ref.Bool(true) 27 assert.True(cfg.VerboseOrDefault()) 28 29 assert.False(cfg.ExitFirstOrDefault()) 30 cfg.ExitFirst = ref.Bool(true) 31 assert.True(cfg.ExitFirstOrDefault()) 32 33 assert.Equal(DefaultRulesFile, cfg.RulesFileOrDefault()) 34 cfg.RulesFile = "foo" 35 assert.Equal("foo", cfg.RulesFileOrDefault()) 36 }