github.com/system-transparency/u-root@v6.0.1-0.20190919065413-ed07a650de4c+incompatible/pkg/uroot/util/root_linux_test.go (about)

     1  // Copyright 2015-2017 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 util
     6  
     7  import (
     8  	"fmt"
     9  	"testing"
    10  )
    11  
    12  func TestFindFileSystem(t *testing.T) {
    13  	var tests = []struct {
    14  		name string
    15  		err  string
    16  	}{
    17  		{"rootfs", "<nil>"},
    18  		{"bogusfs", "bogusfs not found"},
    19  	}
    20  
    21  	for _, tt := range tests {
    22  		t.Run(tt.name, func(t *testing.T) {
    23  			err := FindFileSystem(tt.name)
    24  			// There has to be a better way to do this.
    25  			if fmt.Sprintf("%v", err) != tt.err {
    26  				t.Errorf("%s: got %v, want %v", tt.name, err, tt.err)
    27  			}
    28  		})
    29  	}
    30  }