func TestInit(t *testing.T) {

	// initialize a temporary config file
	confFile, err := ioutil.TempFile("", "cheat-test")
	if err != nil {
		t.Errorf("failed to create temp file: %v", err)
	}

	// clean up the temp file
	defer os.Remove(confFile.Name())

	// initialize the config file
	conf := "mock config data"
	if err = Init(confFile.Name(), conf); err != nil {
		t.Errorf("failed to init config file: %v", err)
	}

	// read back the config file contents
	bytes, err := ioutil.ReadFile(confFile.Name())
	if err != nil {
		t.Errorf("failed to read config file: %v", err)
	}

	// assert that the contents were written correctly
	got := string(bytes)
	if got != conf {
		t.Errorf("failed to write configs: want: %s, got: %s", conf, got)
	}
}
// TestInit asserts that configs are properly initialized
TestInit asserts that configs are properly initialized
// TestInit asserts that configs are properly initialized
func TestInit(t *testing.T) {
	confFile, err := ioutil.TempFile("", "cheat-test")
	if err != nil {
		t.Errorf("failed to create temp file: %v", err)
	}
	defer os.Remove(confFile.Name())
	conf := "mock config data"
	if err = Init(confFile.Name(), conf); err != nil {
		t.Errorf("failed to init config file: %v", err)
	}
	bytes, err := ioutil.ReadFile(confFile.Name())
	if err != nil {
		t.Errorf("failed to read config file: %v", err)
	}
	got := string(bytes)
	if got != conf {
		t.Errorf("failed to write configs: want: %s, got: %s", conf, got)
	}
}
func TestInit ( t * testing . T ) { confFile , err := ioutil . TempFile ( " " , " " ) if err != nil { t . Errorf ( " " , err ) } defer os . Remove ( confFile . Name ( ) ) conf := " " if err = Init ( confFile . Name ( ) , conf ) ; err != nil { t . Errorf ( " " , err ) } bytes , err := ioutil . ReadFile ( confFile . Name ( ) ) if err != nil { t . Errorf ( " " , err ) } got := string ( bytes ) if got != conf { t . Errorf ( " " , conf , got ) } }
TestInit asserts that configs are properly initialized
TestInit asserts that configs are properly initialized
// initialize a temporary config file // clean up the temp file // initialize the config file // read back the config file contents // assert that the contents were written correctly