github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/testing/fstest/mapfs_test.go (about)

     1  // Copyright 2020 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 fstest
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestMapFS(t *testing.T) {
    12  	m := MapFS{
    13  		"hello":             {Data: []byte("hello, world\n")},
    14  		"fortune/k/ken.txt": {Data: []byte("If a program is too slow, it must have a loop.\n")},
    15  	}
    16  	if err := TestFS(m, "hello", "fortune/k/ken.txt"); err != nil {
    17  		t.Fatal(err)
    18  	}
    19  }