github.com/opentofu/opentofu@v1.7.1/internal/encryption/compliancetest/log.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package compliancetest
     7  
     8  import (
     9  	"fmt"
    10  	"testing"
    11  )
    12  
    13  // Log writes a log line for a compliance test.
    14  func Log(t *testing.T, msg string, params ...any) {
    15  	t.Helper()
    16  	t.Logf("\033[32m%s\033[0m", fmt.Sprintf(msg, params...))
    17  }
    18  
    19  // Fail fails a compliance test.
    20  func Fail(t *testing.T, msg string, params ...any) {
    21  	t.Helper()
    22  	t.Fatalf("\033[31m%s\033[0m", fmt.Sprintf(msg, params...))
    23  }
    24  
    25  // Skip skips a compliance test.
    26  func Skip(t *testing.T, msg string, params ...any) {
    27  	t.Helper()
    28  	t.Skipf("\033[33m%s\033[0m", fmt.Sprintf(msg, params...))
    29  }