...

Source file src/github.com/chai2010/gettext-go/testing_test.go

Documentation: github.com/chai2010/gettext-go

     1  // Copyright 2020 ChaiShushan <chaishushan{AT}gmail.com>. 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 gettext
     6  
     7  import (
     8  	"fmt"
     9  	"testing"
    10  )
    11  
    12  func print(a ...interface{}) {
    13  	fmt.Print(a...)
    14  }
    15  func println(a ...interface{}) {
    16  	fmt.Println(a...)
    17  }
    18  func printf(format string, a ...interface{}) {
    19  	fmt.Printf(format, a...)
    20  }
    21  
    22  func tAssert(tb testing.TB, ok bool, a ...interface{}) {
    23  	if !ok {
    24  		tb.Helper()
    25  		if msg := fmt.Sprint(a...); msg != "" {
    26  			tb.Fatal("assert failed:", msg)
    27  		} else {
    28  			tb.Fatal("assert failed")
    29  		}
    30  	}
    31  }
    32  
    33  func tAssertf(tb testing.TB, ok bool, format string, a ...interface{}) {
    34  	if !ok {
    35  		tb.Helper()
    36  		if msg := fmt.Sprintf(format, a...); msg != "" {
    37  			tb.Fatal("assert failed:", msg)
    38  		} else {
    39  			tb.Fatal("assert failed")
    40  		}
    41  	}
    42  }
    43  

View as plain text