File: helpers_test.go

package info (click to toggle)
golang-github-la5nta-wl2k-go 0.11.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,856 kB
  • sloc: ansic: 14; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2015 Martin Hebnes Pedersen (LA5NTA). All rights reserved.
// Use of this source code is governed by the MIT-license that can be
// found in the LICENSE file.

package fbb

import "testing"

func TestErrLine(t *testing.T) {
	err := errLine("*** Unable to decompress received binary compressed message - Disconnecting (88.89.220.254)")
	if err == nil {
		t.Errorf("Expected error, got nil")
	} else if err.Error() != "Unable to decompress received binary compressed message - Disconnecting (88.89.220.254)" {
		t.Errorf("Unexpected error message, got '%s'", err)
	}

	err = errLine("FF ***")
	if err != nil {
		t.Errorf("Expected no error, got '%s'", err)
	}

	err = errLine("* foobar")
	if err == nil {
		t.Errorf("Expected error, got nil")
	}

	err = errLine("*")
	if err != nil {
		t.Errorf("Expected no error, got non nil")
	}
}