Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 495 for testFS (0.74 sec)

  1. src/testing/fstest/testfs.go

    // The contents of fsys must not change concurrently with TestFS.
    //
    // If TestFS finds any misbehaviors, it returns either the first error or a
    // list of errors. Use [errors.Is] or [errors.As] to inspect.
    //
    // Typical usage inside a test is:
    //
    //	if err := fstest.TestFS(myFS, "file/that/should/be/present"); err != nil {
    //		t.Fatal(err)
    //	}
    func TestFS(fsys fs.FS, expected ...string) error {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  2. src/testing/fstest/testfs_test.go

    	if err := os.Symlink(filepath.Join(tmp, "hello"), filepath.Join(tmp, "hello.link")); err != nil {
    		t.Fatal(err)
    	}
    
    	if err := TestFS(tmpfs, "hello", "hello.link"); err != nil {
    		t.Fatal(err)
    	}
    }
    
    func TestDash(t *testing.T) {
    	m := MapFS{
    		"a-b/a": {Data: []byte("a-b/a")},
    	}
    	if err := TestFS(m, "a-b/a"); err != nil {
    		t.Error(err)
    	}
    }
    
    type shuffledFS MapFS
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  3. doc/next/6-stdlib/99-minor/testing/fstest/63675.md

    [TestFS] now returns a structured error that can be unwrapped
    (via method `Unwrap() []error`). This allows inspecting errors
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 12 20:57:18 UTC 2024
    - 159 bytes
    - Viewed (0)
  4. src/io/fs/readdir_test.go

    	}
    
    	for _, test := range tests {
    		test := test
    		t.Run(test.path, func(t *testing.T) {
    			fi, err := Stat(testFs, test.path)
    			if err != nil {
    				t.Fatal(err)
    			}
    
    			dirEntry := FileInfoToDirEntry(fi)
    			if g, w := dirEntry.Type(), test.wantMode; g != w {
    				t.Errorf("FileMode mismatch: got=%v, want=%v", g, w)
    			}
    			if g, w := dirEntry.Name(), test.path; g != w {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 27 16:25:41 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  5. src/slices/sort_test.go

    	// should propagate the NaN to their output.
    	for i := 0; i < len(fs); i++ {
    		testfs := Clone(fs)
    		testfs[i] = math.NaN()
    
    		fmin := Min(testfs)
    		if !math.IsNaN(fmin) {
    			t.Errorf("got min %v, want NaN", fmin)
    		}
    
    		fmax := Max(testfs)
    		if !math.IsNaN(fmax) {
    			t.Errorf("got max %v, want NaN", fmax)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 09 19:20:55 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  6. src/testing/fstest/mapfs_test.go

    )
    
    func TestMapFS(t *testing.T) {
    	m := MapFS{
    		"hello":             {Data: []byte("hello, world\n")},
    		"fortune/k/ken.txt": {Data: []byte("If a program is too slow, it must have a loop.\n")},
    	}
    	if err := TestFS(m, "hello", "fortune", "fortune/k", "fortune/k/ken.txt"); err != nil {
    		t.Fatal(err)
    	}
    }
    
    func TestMapFSChmodDot(t *testing.T) {
    	m := MapFS{
    		"a/b.txt": &MapFile{Mode: 0666},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 14:59:55 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  7. src/embed/internal/embedtest/embed_test.go

    	}
    }
    
    // Tests for issue 49514.
    var _ = '"'
    var _ = '\''
    var _ = '🦆'
    
    func TestGlobal(t *testing.T) {
    	testFiles(t, global, "concurrency.txt", "Concurrency is not parallelism.\n")
    	testFiles(t, global, "testdata/hello.txt", "hello, world\n")
    	testFiles(t, global, "testdata/glass.txt", "I can eat glass and it doesn't hurt me.\n")
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 14 20:10:16 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  8. src/io/fs/fs.go

    		}
    		w++
    	}
    	return string(buf[:w])
    }
    
    // IsDir reports whether m describes a directory.
    // That is, it tests for the [ModeDir] bit being set in m.
    func (m FileMode) IsDir() bool {
    	return m&ModeDir != 0
    }
    
    // IsRegular reports whether m describes a regular file.
    // That is, it tests that no mode type bits are set.
    func (m FileMode) IsRegular() bool {
    	return m&ModeType == 0
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 15 21:21:41 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  9. src/os/os_test.go

    	from, to := "renameFROM", "RENAMEfrom"
    	tests := []struct {
    		name   string
    		create func() error
    	}{
    		{"dir", func() error {
    			return Mkdir(from, 0777)
    		}},
    		{"file", func() error {
    			fd, err := Create(from)
    			if err != nil {
    				return err
    			}
    			return fd.Close()
    		}},
    	}
    
    	for _, test := range tests {
    		pt.Run(test.name, func(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 83.1K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/width_test.go

    			if test.initialSeatsExpected != workestimateGot.InitialSeats {
    				t.Errorf("Expected work estimate to match: %d initial seats, but got: %d", test.initialSeatsExpected, workestimateGot.InitialSeats)
    			}
    			if test.finalSeatsExpected != workestimateGot.FinalSeats {
    				t.Errorf("Expected work estimate to match: %d final seats, but got: %d", test.finalSeatsExpected, workestimateGot.FinalSeats)
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 17K bytes
    - Viewed (0)
Back to top