github.com/mh-cbon/go@v0.0.0-20160603070303-9e112a3fe4c0/src/cmd/internal/pprof/profile/profile_test.go (about)

     1  // Copyright 2015 The Go 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  
     5  package profile
     6  
     7  import (
     8  	"bytes"
     9  	"testing"
    10  )
    11  
    12  func TestEmptyProfile(t *testing.T) {
    13  	var buf bytes.Buffer
    14  	p, err := Parse(&buf)
    15  	if err != nil {
    16  		t.Error("Want no error, got", err)
    17  	}
    18  	if p == nil {
    19  		t.Fatal("Want a valid profile, got <nil>")
    20  	}
    21  	if !p.Empty() {
    22  		t.Errorf("Profile should be empty, got %#v", p)
    23  	}
    24  }