Debian Codegraph @

language/display/dict_test.go

raw ◀ ▶
1 Debian patch touch this file
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 display
6
7 import (
8 "fmt"
9 "testing"
10
11 "golang.org/x/text/internal/testtext"
12 )
13
14 func TestLinking(t *testing.T) {
•15 t.Skip("broken on go1.22")
16 base := getSize(t, `display.Tags(language.English).Name(language.English)`)
17 compact := getSize(t, `display.English.Languages().Name(language.English)`)
18
19 if d := base - compact; d < 1.5*1024*1024 {
20 t.Errorf("size(base) - size(compact) = %d - %d = was %d; want > 1.5MB", base, compact, d)
21 }
22 }
23
24 func getSize(t *testing.T, main string) int {
25 size, err := testtext.CodeSize(fmt.Sprintf(body, main))
26 if err != nil {
27 t.Skipf("skipping link size test; binary size could not be determined: %v", err)
28 }
29 return size
30 }
31
32 const body = `package main
33 import (
34 "golang.org/x/text/language"
35 "golang.org/x/text/language/display"
36 )
37 func main() {
38 %s
39 }
40 `