File: html_test.go

package info (click to toggle)
panicparse 1.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 392 kB
  • sloc: makefile: 2
file content (52 lines) | stat: -rw-r--r-- 1,066 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2018 Marc-Antoine Ruel. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.

package internal

import (
	"io/ioutil"
	"os"
	"testing"

	"github.com/maruel/panicparse/stack"
)

func TestWriteToHTML(t *testing.T) {
	f, err := ioutil.TempFile("", "panicparse")
	if err != nil {
		t.Fatal(err)
	}
	n := f.Name()
	f.Close()
	defer func() {
		if err := os.Remove(n); err != nil {
			t.Fatal(err)
		}
	}()
	buckets := []*stack.Bucket{
		{
			Signature: stack.Signature{
				State: "chan receive",
				Stack: stack.Stack{
					Calls: []stack.Call{
						{
							SrcPath: "/gopath/src/github.com/maruel/panicparse/stack/stack.go",
							Line:    72,
							Func:    stack.Func{Raw: "main.funcĀ·001"},
							Args:    stack.Args{Values: []stack.Arg{{Value: 0x11000000, Name: ""}, {Value: 2}}},
						},
					},
				},
			},
			IDs:   []int{1, 2},
			First: true,
		},
		{
			IDs: []int{3},
		},
	}
	if err := writeToHTML(n, buckets, true); err != nil {
		t.Fatal(err)
	}
}