github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/common/flogging/fabenc/color_test.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package fabenc_test 8 9 import ( 10 "testing" 11 12 "github.com/hyperledger/fabric/common/flogging/fabenc" 13 "github.com/stretchr/testify/assert" 14 ) 15 16 func TestReset(t *testing.T) { 17 assert.Equal(t, fabenc.ResetColor(), "\x1b[0m") 18 } 19 20 func TestNormalColors(t *testing.T) { 21 assert.Equal(t, fabenc.ColorBlack.Normal(), "\x1b[30m") 22 assert.Equal(t, fabenc.ColorRed.Normal(), "\x1b[31m") 23 assert.Equal(t, fabenc.ColorGreen.Normal(), "\x1b[32m") 24 assert.Equal(t, fabenc.ColorYellow.Normal(), "\x1b[33m") 25 assert.Equal(t, fabenc.ColorBlue.Normal(), "\x1b[34m") 26 assert.Equal(t, fabenc.ColorMagenta.Normal(), "\x1b[35m") 27 assert.Equal(t, fabenc.ColorCyan.Normal(), "\x1b[36m") 28 assert.Equal(t, fabenc.ColorWhite.Normal(), "\x1b[37m") 29 } 30 31 func TestBoldColors(t *testing.T) { 32 assert.Equal(t, fabenc.ColorBlack.Bold(), "\x1b[30;1m") 33 assert.Equal(t, fabenc.ColorRed.Bold(), "\x1b[31;1m") 34 assert.Equal(t, fabenc.ColorGreen.Bold(), "\x1b[32;1m") 35 assert.Equal(t, fabenc.ColorYellow.Bold(), "\x1b[33;1m") 36 assert.Equal(t, fabenc.ColorBlue.Bold(), "\x1b[34;1m") 37 assert.Equal(t, fabenc.ColorMagenta.Bold(), "\x1b[35;1m") 38 assert.Equal(t, fabenc.ColorCyan.Bold(), "\x1b[36;1m") 39 assert.Equal(t, fabenc.ColorWhite.Bold(), "\x1b[37;1m") 40 }