github.com/jlowellwofford/u-root@v1.0.0/cmds/false/false_test.go (about)

     1  // Copyright 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 main
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/u-root/u-root/pkg/testutil"
    11  )
    12  
    13  func TestFalse(t *testing.T) {
    14  	// Ensure 1 is returned.
    15  	out, err := testutil.Command(t).CombinedOutput()
    16  	if err := testutil.IsExitCode(err, 1); err != nil {
    17  		t.Error(err)
    18  	}
    19  	if len(out) != 0 {
    20  		t.Fatalf("Expected no output; got %#v", string(out))
    21  	}
    22  }
    23  
    24  func TestMain(m *testing.M) {
    25  	testutil.Run(m, main)
    26  }