mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-30 00:46:00 +00:00 
			
		
		
		
	Many cli and arch files were using the 'older style' fairly full Apache license text. The project standard is the shorter SPDX style. Convert them over. Fixes: #225 Signed-off-by: Graham whaley <graham.whaley@intel.com>
		
			
				
	
	
		
			43 lines
		
	
	
		
			637 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			637 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) 2017 Intel Corporation
 | |
| //
 | |
| // SPDX-License-Identifier: Apache-2.0
 | |
| //
 | |
| 
 | |
| package main
 | |
| 
 | |
| import (
 | |
| 	"os"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/stretchr/testify/assert"
 | |
| )
 | |
| 
 | |
| var testFoo string
 | |
| 
 | |
| func testFunc() {
 | |
| 	testFoo = "bar"
 | |
| }
 | |
| 
 | |
| func TestExit(t *testing.T) {
 | |
| 	assert := assert.New(t)
 | |
| 
 | |
| 	var testExitStatus int
 | |
| 	exitFunc = func(status int) {
 | |
| 		testExitStatus = status
 | |
| 	}
 | |
| 
 | |
| 	defer func() {
 | |
| 		exitFunc = os.Exit
 | |
| 	}()
 | |
| 
 | |
| 	// test with no atexit functions added.
 | |
| 	exit(1)
 | |
| 	assert.Equal(testExitStatus, 1)
 | |
| 
 | |
| 	// test with a function added to the atexit list.
 | |
| 	atexit(testFunc)
 | |
| 	exit(0)
 | |
| 	assert.Equal(testFoo, "bar")
 | |
| 	assert.Equal(testExitStatus, 0)
 | |
| }
 |