tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/engine/fs/unionfs/fs_test.go (about)

     1  package unionfs
     2  
     3  import (
     4  	"testing"
     5  
     6  	"tractor.dev/toolkit-go/engine/fs/fstest"
     7  	"tractor.dev/toolkit-go/engine/fs/memfs"
     8  )
     9  
    10  func TestUnionFS(t *testing.T) {
    11  
    12  	base := memfs.New()
    13  	overlay := memfs.New()
    14  
    15  	fstest.WriteFS(t, base, map[string]string{
    16  		"all":      "base",
    17  		"sub/base": "base",
    18  	})
    19  
    20  	fstest.WriteFS(t, overlay, map[string]string{
    21  		"all":         "overlay",
    22  		"sub/overlay": "overlay",
    23  	})
    24  
    25  	fsys := New(base, overlay)
    26  
    27  	fstest.CheckFS(t, fsys, map[string]string{
    28  		"all":         "overlay",
    29  		"sub/base":    "base",
    30  		"sub/overlay": "overlay",
    31  	})
    32  
    33  }