Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for DirFS (0.03 sec)

  1. src/io/fs/glob_test.go

    	"path"
    	"slices"
    	"strings"
    	"testing"
    )
    
    var globTests = []struct {
    	fs              FS
    	pattern, result string
    }{
    	{os.DirFS("."), "glob.go", "glob.go"},
    	{os.DirFS("."), "gl?b.go", "glob.go"},
    	{os.DirFS("."), `gl\ob.go`, "glob.go"},
    	{os.DirFS("."), "*", "glob.go"},
    	{os.DirFS(".."), "*/glob.go", "fs/glob.go"},
    }
    
    func TestGlob(t *testing.T) {
    	for _, tt := range globTests {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 18:36:52 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  2. src/os/file.go

    // [io/fs.ReadDirFS].
    func DirFS(dir string) fs.FS {
    	return dirFS(dir)
    }
    
    type dirFS string
    
    func (dir dirFS) Open(name string) (fs.File, error) {
    	fullname, err := dir.join(name)
    	if err != nil {
    		return nil, &PathError{Op: "open", Path: name, Err: err}
    	}
    	f, err := Open(fullname)
    	if err != nil {
    		// DirFS takes a string appropriate for GOOS,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 23:07:37 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  3. src/os/os_test.go

    	// Test that Open can open a path starting at /.
    	d := DirFS("/")
    	f, err := d.Open(cwd + "/testdata/dirfs/a")
    	if err != nil {
    		t.Fatal(err)
    	}
    	f.Close()
    }
    
    func TestDirFSEmptyDir(t *testing.T) {
    	t.Parallel()
    
    	d := DirFS("")
    	cwd, _ := Getwd()
    	for _, path := range []string{
    		"testdata/dirfs/a",                          // not DirFS(".")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 83.1K bytes
    - Viewed (0)
  4. src/testing/fstest/testfs_test.go

    	"errors"
    	"internal/testenv"
    	"io/fs"
    	"os"
    	"path/filepath"
    	"slices"
    	"strings"
    	"testing"
    )
    
    func TestSymlink(t *testing.T) {
    	testenv.MustHaveSymlink(t)
    
    	tmp := t.TempDir()
    	tmpfs := os.DirFS(tmp)
    
    	if err := os.WriteFile(filepath.Join(tmp, "hello"), []byte("hello, world\n"), 0644); err != nil {
    		t.Fatal(err)
    	}
    
    	if err := os.Symlink(filepath.Join(tmp, "hello"), filepath.Join(tmp, "hello.link")); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  5. cni/pkg/nodeagent/server.go

    		return nil, fmt.Errorf("error initializing the host rules for health checks: %w", err)
    	}
    
    	podNetns := NewPodNetnsProcFinder(os.DirFS(filepath.Join(pconstants.HostMountsPath, "proc")))
    	netServer := newNetServer(ztunnelServer, podNsMap, iptablesConfigurator, podNetns, set)
    
    	// Set some defaults
    	s := &Server{
    		ctx:        ctx,
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 31 21:45:18 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  6. src/net/http/fs_test.go

    	for i := 0; i < 2; i++ {
    		var h Handler
    		var name string
    		switch i {
    		case 0:
    			h = FileServer(Dir("."))
    			name = "Dir"
    		case 1:
    			h = FileServer(FS(os.DirFS(".")))
    			name = "DirFS"
    		}
    		t.Run(name, func(t *testing.T) {
    			const want = "index.html says hello\n"
    			ts := newClientServerTest(t, mode, h).ts
    
    			for _, path := range []string{"/testdata/", "/testdata/index.html"} {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 23:39:44 UTC 2024
    - 49.9K bytes
    - Viewed (0)
Back to top