GoPLS Viewer

Home|gopls/go/pointer/pointer_go117_test.go
1// Copyright 2021 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// No testdata on Android.
6
7//go:build !android && go1.17
8// +build !android,go1.17
9
10package pointer_test
11
12import (
13    "fmt"
14    "io/ioutil"
15    "os"
16    "path/filepath"
17    "testing"
18)
19
20func TestSliceToArrayPointer(t *testing.T) {
21    // Based on TestInput. Keep this up to date with that.
22    filename := "testdata/arrays_go117.go"
23
24    if testing.Short() {
25        t.Skip("skipping in short mode; this test requires tons of memory; https://golang.org/issue/14113")
26    }
27
28    wderr := os.Getwd()
29    if err != nil {
30        t.Fatalf("os.Getwd: %s"err)
31    }
32    fmt.Fprintf(os.Stderr"Entering directory `%s'\n"wd)
33
34    contenterr := ioutil.ReadFile(filename)
35    if err != nil {
36        t.Fatalf("couldn't read file '%s': %s"filenameerr)
37    }
38    fpatherr := filepath.Abs(filename)
39    if err != nil {
40        t.Errorf("couldn't get absolute path for '%s': %s"filenameerr)
41    }
42
43    if !doOneInput(tstring(content), fpath) {
44        t.Fail()
45    }
46}
47
MembersX
testing
TestSliceToArrayPointer.filename
TestSliceToArrayPointer.wd
TestSliceToArrayPointer.err
TestSliceToArrayPointer.fpath
ioutil
filepath
TestSliceToArrayPointer
TestSliceToArrayPointer.t
TestSliceToArrayPointer.content
Members
X