File: loginshell_test.go

package info (click to toggle)
golang-github-riywo-loginshell 0.0~git20190610.2ed199a-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 68 kB
  • sloc: makefile: 3
file content (26 lines) | stat: -rw-r--r-- 496 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package loginshell

import (
    "testing"
    "os"
    "fmt"
    "runtime"
)

func TestShell(t *testing.T) {
    shell, err := Shell()
    if err != nil {
        t.Error(err)
    }

    if runtime.GOOS == "windows" {
        if shell == "" {
            t.Error("Output is empty!")
        }
    } else {
        currentShell := os.Getenv("SHELL")
        if shell != currentShell {
            t.Error(fmt.Sprintf("Output: %s, Current login shell: %s", shell, currentShell))
        }
    }
}