Source file src/internal/profile/profile_test.go
1 // Copyright 2026 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 TestParseDanglingLocationID(t *testing.T) { 13 // Profile containing a sample referencing non-existent location ID 99. 14 raw := []byte{ 15 0x32, 0x00, 0x32, 0x07, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x32, 0x05, 0x63, 0x6f, 16 0x75, 0x6e, 0x74, 0x0a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x63, 0x10, 0x01, 17 } 18 if _, err := Parse(bytes.NewReader(raw)); err == nil { 19 t.Fatal("Parse succeeded, want error for dangling location ID") 20 } 21 } 22