blob: 86a8d247176a6495f3181f34847b6a5a3c236b25 [file] [log] [blame]
Jiri Simsad7616c92015-03-24 23:44:30 -07001// Copyright 2015 The Vanadium Authors. 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
Jiri Simsa73e9cac2014-06-30 09:55:10 -07005package testutil
Jiri Simsa5293dcb2014-05-10 09:56:38 -07006
7import (
Jiri Simsa5293dcb2014-05-10 09:56:38 -07008 "regexp"
9 "testing"
Jiri Simsa5293dcb2014-05-10 09:56:38 -070010)
11
12func TestFormatLogline(t *testing.T) {
Jiri Simsa73e9cac2014-06-30 09:55:10 -070013 depth, want := DepthToExternalCaller(), 2
Jiri Simsa5293dcb2014-05-10 09:56:38 -070014 if depth != want {
15 t.Errorf("got %v, want %v", depth, want)
16 }
17 {
Jiri Simsa73e9cac2014-06-30 09:55:10 -070018 line, want := FormatLogLine(depth, "test"), "testing.go:.*"
Jiri Simsa5293dcb2014-05-10 09:56:38 -070019 if ok, err := regexp.MatchString(want, line); !ok || err != nil {
20 t.Errorf("got %v, want %v", line, want)
21 }
22 }
23}