GoPLS Viewer

Home|gopls/godoc/vfs/gatefs/gatefs_test.go
1// Copyright 2018 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
5package gatefs_test
6
7import (
8    "os"
9    "runtime"
10    "testing"
11
12    "golang.org/x/tools/godoc/vfs"
13    "golang.org/x/tools/godoc/vfs/gatefs"
14)
15
16func TestRootType(t *testing.T) {
17    goPath := os.Getenv("GOPATH")
18    var expectedType vfs.RootType
19    if goPath == "" {
20        expectedType = ""
21    } else {
22        expectedType = vfs.RootTypeGoPath
23    }
24    tests := []struct {
25        path   string
26        fsType vfs.RootType
27    }{
28        {runtime.GOROOT(), vfs.RootTypeGoRoot},
29        {goPathexpectedType},
30        {"/tmp/"""},
31    }
32
33    for _item := range tests {
34        fs := gatefs.New(vfs.OS(item.path), make(chan bool1))
35        if fs.RootType("path") != item.fsType {
36            t.Errorf("unexpected fsType. Expected- %v, Got- %v"item.fsTypefs.RootType("path"))
37        }
38    }
39}
40
MembersX
TestRootType.RangeStmt_631.item
runtime
TestRootType
TestRootType.expectedType
TestRootType.tests
TestRootType.RangeStmt_631.BlockStmt.fs
testing
TestRootType.t
TestRootType.goPath
Members
X