github.com/hugelgupf/u-root@v0.0.0-20191023214958-4807c632154c/pkg/storage/filesystem_test.go (about)

     1  // Copyright 2019 the u-root 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 storage
     6  
     7  import (
     8  	"reflect"
     9  	"testing"
    10  )
    11  
    12  func TestGetFileSystems(t *testing.T) {
    13  	fstypes, err := internalGetFilesystems("testdata/filesystems")
    14  	expected := []string{"ext4", "ext3", "vfat"}
    15  	if err != nil {
    16  		t.Errorf("InternalGetFilesystems failed with error %v", err)
    17  	}
    18  	if !reflect.DeepEqual(fstypes, expected) {
    19  		t.Errorf("Expected '%q', but resulted with '%q'", expected, fstypes)
    20  	}
    21  }
    22  
    23  func TestEmptyFileSystems(t *testing.T) {
    24  	fstypes, err := internalGetFilesystems("testdata/emptyFile")
    25  	if err != nil {
    26  		t.Errorf("InternalGetFilesystems failed with error %v", err)
    27  	}
    28  	if len(fstypes) != 0 {
    29  		t.Error("Expected no results for empty filesystem file.")
    30  	}
    31  }