mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-14 17:18:46 +02:00
well, it builds :D but still failing all the tests
This commit is contained in:
@ -1,24 +1,12 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
func Check(t *testing.T, err error) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func CheckWithInfo(t *testing.T, err error, additionalInfo string) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v! Additional info: %v", err, additionalInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func BackupAndRestore(t *testing.T) func() {
|
||||
homedir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
@ -33,14 +21,36 @@ func BackupAndRestore(t *testing.T) func() {
|
||||
}
|
||||
}
|
||||
|
||||
func Check(t *testing.T, err error) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func CheckWithInfo(t *testing.T, err error, additionalInfo string) {
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v! Additional info: %v", err, additionalInfo)
|
||||
}
|
||||
}
|
||||
|
||||
func EntryEquals(entry1, entry2 HistoryEntry) bool {
|
||||
return entry1.UserSecret == entry2.UserSecret &&
|
||||
entry1.LocalUsername == entry2.LocalUsername &&
|
||||
return entry1.LocalUsername == entry2.LocalUsername &&
|
||||
entry1.Hostname == entry2.Hostname &&
|
||||
entry1.Command == entry2.Command &&
|
||||
entry1.CurrentWorkingDirectory == entry2.CurrentWorkingDirectory &&
|
||||
entry1.ExitCode == entry2.ExitCode &&
|
||||
entry1.StartTime.Format(time.RFC3339) == entry2.StartTime.Format(time.RFC3339) &&
|
||||
entry1.EndTime.Format(time.RFC3339) == entry2.EndTime.Format(time.RFC3339)
|
||||
|
||||
}
|
||||
|
||||
func MakeFakeHistoryEntry(command string) HistoryEntry {
|
||||
return HistoryEntry{
|
||||
LocalUsername: "david",
|
||||
Hostname: "localhost",
|
||||
Command: command,
|
||||
CurrentWorkingDirectory: "/tmp/",
|
||||
ExitCode: 2,
|
||||
StartTime: time.Now(),
|
||||
EndTime: time.Now(),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user