File: debug_test.go

package info (click to toggle)
golang-bugst-relaxed-semver 0.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: makefile: 2
file content (33 lines) | stat: -rw-r--r-- 601 bytes parent folder | download
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
32
33
//
// Copyright 2018-2025 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

package semver

import (
	"fmt"
	rtdebug "runtime/debug"
	"strings"
	"testing"
)

func init() {
	debug = func(format string, a ...interface{}) {
		level := strings.Count(string(rtdebug.Stack()), "\n")
		for i := 0; i < level; i++ {
			fmt.Print(" ")
		}
		if a != nil {
			fmt.Printf(format, a...)
			fmt.Println()
		} else {
			fmt.Println(format)
		}
	}
}

func TestNoopDebug(t *testing.T) {
	noopDebug("just for coverage!")
}