github.com/la5nta/wl2k-go@v0.11.8/fbb/helpers_test.go (about) 1 // Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved. 2 // Use of this source code is governed by the MIT-license that can be 3 // found in the LICENSE file. 4 5 package fbb 6 7 import "testing" 8 9 func TestErrLine(t *testing.T) { 10 err := errLine("*** Unable to decompress received binary compressed message - Disconnecting (88.89.220.254)") 11 if err == nil { 12 t.Errorf("Expected error, got nil") 13 } else if err.Error() != "Unable to decompress received binary compressed message - Disconnecting (88.89.220.254)" { 14 t.Errorf("Unexpected error message, got '%s'", err) 15 } 16 17 err = errLine("FF ***") 18 if err != nil { 19 t.Errorf("Expected no error, got '%s'", err) 20 } 21 22 err = errLine("* foobar") 23 if err == nil { 24 t.Errorf("Expected error, got nil") 25 } 26 27 err = errLine("*") 28 if err != nil { 29 t.Errorf("Expected no error, got non nil") 30 } 31 }