mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
e62482c56f
commit
3d4fc5b6dd
|
@ -16,17 +16,17 @@ func TestGetTitle(t *testing.T) {
|
||||||
Root bool
|
Root bool
|
||||||
User string
|
User string
|
||||||
Cwd string
|
Cwd string
|
||||||
PathSeperator string
|
PathSeparator string
|
||||||
ShellName string
|
ShellName string
|
||||||
Expected string
|
Expected string
|
||||||
}{
|
}{
|
||||||
{Style: FolderName, Cwd: "/usr/home", PathSeperator: "/", ShellName: "default", Expected: "\x1b]0;~\a"},
|
{Style: FolderName, Cwd: "/usr/home", PathSeparator: "/", ShellName: "default", Expected: "\x1b]0;~\a"},
|
||||||
{Style: FullPath, Cwd: "/usr/home/jan", PathSeperator: "/", ShellName: "default", Expected: "\x1b]0;~/jan\a"},
|
{Style: FullPath, Cwd: "/usr/home/jan", PathSeparator: "/", ShellName: "default", Expected: "\x1b]0;~/jan\a"},
|
||||||
{
|
{
|
||||||
Style: Template,
|
Style: Template,
|
||||||
Template: "{{.Env.USERDOMAIN}} :: {{.PWD}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
Template: "{{.Env.USERDOMAIN}} :: {{.PWD}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
||||||
Cwd: "C:\\vagrant",
|
Cwd: "C:\\vagrant",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
ShellName: "PowerShell",
|
ShellName: "PowerShell",
|
||||||
Root: true,
|
Root: true,
|
||||||
Expected: "\x1b]0;MyCompany :: C:\\vagrant :: Admin :: PowerShell\a",
|
Expected: "\x1b]0;MyCompany :: C:\\vagrant :: Admin :: PowerShell\a",
|
||||||
|
@ -35,7 +35,7 @@ func TestGetTitle(t *testing.T) {
|
||||||
Style: Template,
|
Style: Template,
|
||||||
Template: "{{.Folder}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
Template: "{{.Folder}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
||||||
Cwd: "C:\\vagrant",
|
Cwd: "C:\\vagrant",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
ShellName: "PowerShell",
|
ShellName: "PowerShell",
|
||||||
Expected: "\x1b]0;vagrant :: PowerShell\a",
|
Expected: "\x1b]0;vagrant :: PowerShell\a",
|
||||||
},
|
},
|
||||||
|
@ -44,7 +44,7 @@ func TestGetTitle(t *testing.T) {
|
||||||
Template: "{{.UserName}}@{{.HostName}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
Template: "{{.UserName}}@{{.HostName}}{{if .Root}} :: Admin{{end}} :: {{.Shell}}",
|
||||||
Root: true,
|
Root: true,
|
||||||
User: "MyUser",
|
User: "MyUser",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
ShellName: "PowerShell",
|
ShellName: "PowerShell",
|
||||||
Expected: "\x1b]0;MyUser@MyHost :: Admin :: PowerShell\a",
|
Expected: "\x1b]0;MyUser@MyHost :: Admin :: PowerShell\a",
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ func TestGetTitle(t *testing.T) {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("Pwd").Return(tc.Cwd)
|
env.On("Pwd").Return(tc.Cwd)
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("PathSeperator").Return(tc.PathSeperator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("TemplateCache").Return(&environment.TemplateCache{
|
env.On("TemplateCache").Return(&environment.TemplateCache{
|
||||||
Env: map[string]string{
|
Env: map[string]string{
|
||||||
"USERDOMAIN": "MyCompany",
|
"USERDOMAIN": "MyCompany",
|
||||||
|
@ -86,7 +86,7 @@ func TestGetConsoleTitleIfGethostnameReturnsError(t *testing.T) {
|
||||||
Root bool
|
Root bool
|
||||||
User string
|
User string
|
||||||
Cwd string
|
Cwd string
|
||||||
PathSeperator string
|
PathSeparator string
|
||||||
ShellName string
|
ShellName string
|
||||||
Expected string
|
Expected string
|
||||||
}{
|
}{
|
||||||
|
@ -94,7 +94,7 @@ func TestGetConsoleTitleIfGethostnameReturnsError(t *testing.T) {
|
||||||
Style: Template,
|
Style: Template,
|
||||||
Template: "Not using Host only {{.UserName}} and {{.Shell}}",
|
Template: "Not using Host only {{.UserName}} and {{.Shell}}",
|
||||||
User: "MyUser",
|
User: "MyUser",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
ShellName: "PowerShell",
|
ShellName: "PowerShell",
|
||||||
Expected: "\x1b]0;Not using Host only MyUser and PowerShell\a",
|
Expected: "\x1b]0;Not using Host only MyUser and PowerShell\a",
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ func TestGetConsoleTitleIfGethostnameReturnsError(t *testing.T) {
|
||||||
Style: Template,
|
Style: Template,
|
||||||
Template: "{{.UserName}}@{{.HostName}} :: {{.Shell}}",
|
Template: "{{.UserName}}@{{.HostName}} :: {{.Shell}}",
|
||||||
User: "MyUser",
|
User: "MyUser",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
ShellName: "PowerShell",
|
ShellName: "PowerShell",
|
||||||
Expected: "\x1b]0;MyUser@ :: PowerShell\a",
|
Expected: "\x1b]0;MyUser@ :: PowerShell\a",
|
||||||
},
|
},
|
||||||
|
|
|
@ -145,7 +145,7 @@ type Environment interface {
|
||||||
Shell() string
|
Shell() string
|
||||||
Platform() string
|
Platform() string
|
||||||
ErrorCode() int
|
ErrorCode() int
|
||||||
PathSeperator() string
|
PathSeparator() string
|
||||||
HasFiles(pattern string) bool
|
HasFiles(pattern string) bool
|
||||||
HasFilesInDir(dir, pattern string) bool
|
HasFilesInDir(dir, pattern string) bool
|
||||||
HasFolder(folder string) bool
|
HasFolder(folder string) bool
|
||||||
|
@ -300,7 +300,7 @@ func (env *ShellEnvironment) Pwd() string {
|
||||||
func (env *ShellEnvironment) HasFiles(pattern string) bool {
|
func (env *ShellEnvironment) HasFiles(pattern string) bool {
|
||||||
defer env.trace(time.Now(), "HasFiles", pattern)
|
defer env.trace(time.Now(), "HasFiles", pattern)
|
||||||
cwd := env.Pwd()
|
cwd := env.Pwd()
|
||||||
pattern = cwd + env.PathSeperator() + pattern
|
pattern = cwd + env.PathSeparator() + pattern
|
||||||
matches, err := filepath.Glob(pattern)
|
matches, err := filepath.Glob(pattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
env.log(Error, "HasFiles", err.Error())
|
env.log(Error, "HasFiles", err.Error())
|
||||||
|
@ -311,7 +311,7 @@ func (env *ShellEnvironment) HasFiles(pattern string) bool {
|
||||||
|
|
||||||
func (env *ShellEnvironment) HasFilesInDir(dir, pattern string) bool {
|
func (env *ShellEnvironment) HasFilesInDir(dir, pattern string) bool {
|
||||||
defer env.trace(time.Now(), "HasFilesInDir", pattern)
|
defer env.trace(time.Now(), "HasFilesInDir", pattern)
|
||||||
pattern = dir + env.PathSeperator() + pattern
|
pattern = dir + env.PathSeparator() + pattern
|
||||||
matches, err := filepath.Glob(pattern)
|
matches, err := filepath.Glob(pattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
env.log(Error, "HasFilesInDir", err.Error())
|
env.log(Error, "HasFilesInDir", err.Error())
|
||||||
|
@ -371,8 +371,8 @@ func (env *ShellEnvironment) FolderList(path string) []string {
|
||||||
return folderNames
|
return folderNames
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *ShellEnvironment) PathSeperator() string {
|
func (env *ShellEnvironment) PathSeparator() string {
|
||||||
defer env.trace(time.Now(), "PathSeperator")
|
defer env.trace(time.Now(), "PathSeparator")
|
||||||
return string(os.PathSeparator)
|
return string(os.PathSeparator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ func Base(env Environment, path string) string {
|
||||||
}
|
}
|
||||||
volumeName := filepath.VolumeName(path)
|
volumeName := filepath.VolumeName(path)
|
||||||
// Strip trailing slashes.
|
// Strip trailing slashes.
|
||||||
for len(path) > 0 && string(path[len(path)-1]) == env.PathSeperator() {
|
for len(path) > 0 && string(path[len(path)-1]) == env.PathSeparator() {
|
||||||
path = path[0 : len(path)-1]
|
path = path[0 : len(path)-1]
|
||||||
}
|
}
|
||||||
if volumeName == path {
|
if volumeName == path {
|
||||||
|
@ -708,7 +708,7 @@ func Base(env Environment, path string) string {
|
||||||
path = path[len(filepath.VolumeName(path)):]
|
path = path[len(filepath.VolumeName(path)):]
|
||||||
// Find the last element
|
// Find the last element
|
||||||
i := len(path) - 1
|
i := len(path) - 1
|
||||||
for i >= 0 && string(path[i]) != env.PathSeperator() {
|
for i >= 0 && string(path[i]) != env.PathSeparator() {
|
||||||
i--
|
i--
|
||||||
}
|
}
|
||||||
if i >= 0 {
|
if i >= 0 {
|
||||||
|
@ -716,7 +716,7 @@ func Base(env Environment, path string) string {
|
||||||
}
|
}
|
||||||
// If empty now, it had only slashes.
|
// If empty now, it had only slashes.
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return env.PathSeperator()
|
return env.PathSeparator()
|
||||||
}
|
}
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (env *MockedEnvironment) FolderList(path string) []string {
|
||||||
return args.Get(0).([]string)
|
return args.Get(0).([]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *MockedEnvironment) PathSeperator() string {
|
func (env *MockedEnvironment) PathSeparator() string {
|
||||||
args := env.Called()
|
args := env.Called()
|
||||||
return args.String(0)
|
return args.String(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ func TestDotnetSegment(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
env.On("HasFiles", "*.cs").Return(true)
|
env.On("HasFiles", "*.cs").Return(true)
|
||||||
env.On("PathSeperator").Return("")
|
env.On("PathSeparator").Return("")
|
||||||
env.On("Pwd").Return("/usr/home/project")
|
env.On("Pwd").Return("/usr/home/project")
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("TemplateCache").Return(&environment.TemplateCache{
|
env.On("TemplateCache").Return(&environment.TemplateCache{
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (pt *Path) Init(props properties.Properties, env environment.Environment) {
|
||||||
func (pt *Path) getMixedPath() string {
|
func (pt *Path) getMixedPath() string {
|
||||||
var buffer strings.Builder
|
var buffer strings.Builder
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
splitted := strings.Split(pwd, pt.env.PathSeperator())
|
splitted := strings.Split(pwd, pt.env.PathSeparator())
|
||||||
threshold := int(pt.props.GetFloat64(MixedThreshold, 4))
|
threshold := int(pt.props.GetFloat64(MixedThreshold, 4))
|
||||||
for i, part := range splitted {
|
for i, part := range splitted {
|
||||||
if part == "" {
|
if part == "" {
|
||||||
|
@ -126,7 +126,7 @@ func (pt *Path) getMixedPath() string {
|
||||||
if len(part) > threshold && i != 0 && i != len(splitted)-1 {
|
if len(part) > threshold && i != 0 && i != len(splitted)-1 {
|
||||||
folder = pt.props.GetString(FolderIcon, "..")
|
folder = pt.props.GetString(FolderIcon, "..")
|
||||||
}
|
}
|
||||||
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeperator())
|
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeparator())
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
separator = ""
|
separator = ""
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ func (pt *Path) getAgnosterPath() string {
|
||||||
buffer.WriteString(pt.rootLocation())
|
buffer.WriteString(pt.rootLocation())
|
||||||
pathDepth := pt.pathDepth(pwd)
|
pathDepth := pt.pathDepth(pwd)
|
||||||
folderIcon := pt.props.GetString(FolderIcon, "..")
|
folderIcon := pt.props.GetString(FolderIcon, "..")
|
||||||
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeperator())
|
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeparator())
|
||||||
for i := 1; i < pathDepth; i++ {
|
for i := 1; i < pathDepth; i++ {
|
||||||
buffer.WriteString(fmt.Sprintf("%s%s", separator, folderIcon))
|
buffer.WriteString(fmt.Sprintf("%s%s", separator, folderIcon))
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ func (pt *Path) getAgnosterPath() string {
|
||||||
|
|
||||||
func (pt *Path) getAgnosterLeftPath() string {
|
func (pt *Path) getAgnosterLeftPath() string {
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
separator := pt.env.PathSeperator()
|
separator := pt.env.PathSeparator()
|
||||||
pwd = strings.Trim(pwd, separator)
|
pwd = strings.Trim(pwd, separator)
|
||||||
splitted := strings.Split(pwd, separator)
|
splitted := strings.Split(pwd, separator)
|
||||||
folderIcon := pt.props.GetString(FolderIcon, "..")
|
folderIcon := pt.props.GetString(FolderIcon, "..")
|
||||||
|
@ -191,8 +191,8 @@ func (pt *Path) getRelevantLetter(folder string) string {
|
||||||
func (pt *Path) getLetterPath() string {
|
func (pt *Path) getLetterPath() string {
|
||||||
var buffer strings.Builder
|
var buffer strings.Builder
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
splitted := strings.Split(pwd, pt.env.PathSeperator())
|
splitted := strings.Split(pwd, pt.env.PathSeparator())
|
||||||
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeperator())
|
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeparator())
|
||||||
for i := 0; i < len(splitted)-1; i++ {
|
for i := 0; i < len(splitted)-1; i++ {
|
||||||
folder := splitted[i]
|
folder := splitted[i]
|
||||||
if len(folder) == 0 {
|
if len(folder) == 0 {
|
||||||
|
@ -210,8 +210,8 @@ func (pt *Path) getLetterPath() string {
|
||||||
func (pt *Path) getUniqueLettersPath() string {
|
func (pt *Path) getUniqueLettersPath() string {
|
||||||
var buffer strings.Builder
|
var buffer strings.Builder
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
splitted := strings.Split(pwd, pt.env.PathSeperator())
|
splitted := strings.Split(pwd, pt.env.PathSeparator())
|
||||||
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeperator())
|
separator := pt.props.GetString(FolderSeparatorIcon, pt.env.PathSeparator())
|
||||||
letters := make(map[string]bool, len(splitted))
|
letters := make(map[string]bool, len(splitted))
|
||||||
for i := 0; i < len(splitted)-1; i++ {
|
for i := 0; i < len(splitted)-1; i++ {
|
||||||
folder := splitted[i]
|
folder := splitted[i]
|
||||||
|
@ -236,7 +236,7 @@ func (pt *Path) getUniqueLettersPath() string {
|
||||||
|
|
||||||
func (pt *Path) getAgnosterFullPath() string {
|
func (pt *Path) getAgnosterFullPath() string {
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
if len(pwd) > 1 && string(pwd[0]) == pt.env.PathSeperator() {
|
if len(pwd) > 1 && string(pwd[0]) == pt.env.PathSeparator() {
|
||||||
pwd = pwd[1:]
|
pwd = pwd[1:]
|
||||||
}
|
}
|
||||||
return pt.replaceFolderSeparators(pwd)
|
return pt.replaceFolderSeparators(pwd)
|
||||||
|
@ -252,7 +252,7 @@ func (pt *Path) getAgnosterShortPath() string {
|
||||||
if pathDepth <= maxDepth {
|
if pathDepth <= maxDepth {
|
||||||
return pt.getAgnosterFullPath()
|
return pt.getAgnosterFullPath()
|
||||||
}
|
}
|
||||||
pathSeparator := pt.env.PathSeperator()
|
pathSeparator := pt.env.PathSeparator()
|
||||||
folderSeparator := pt.props.GetString(FolderSeparatorIcon, pathSeparator)
|
folderSeparator := pt.props.GetString(FolderSeparatorIcon, pathSeparator)
|
||||||
folderIcon := pt.props.GetString(FolderIcon, "..")
|
folderIcon := pt.props.GetString(FolderIcon, "..")
|
||||||
root := pt.rootLocation()
|
root := pt.rootLocation()
|
||||||
|
@ -341,7 +341,7 @@ func (pt *Path) replaceMappedLocations(pwd string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pt *Path) replaceFolderSeparators(pwd string) string {
|
func (pt *Path) replaceFolderSeparators(pwd string) string {
|
||||||
defaultSeparator := pt.env.PathSeperator()
|
defaultSeparator := pt.env.PathSeparator()
|
||||||
if pwd == defaultSeparator {
|
if pwd == defaultSeparator {
|
||||||
return pwd
|
return pwd
|
||||||
}
|
}
|
||||||
|
@ -360,14 +360,14 @@ func (pt *Path) inHomeDir(pwd string) bool {
|
||||||
|
|
||||||
func (pt *Path) rootLocation() string {
|
func (pt *Path) rootLocation() string {
|
||||||
pwd := pt.getPwd()
|
pwd := pt.getPwd()
|
||||||
pwd = strings.TrimPrefix(pwd, pt.env.PathSeperator())
|
pwd = strings.TrimPrefix(pwd, pt.env.PathSeparator())
|
||||||
splitted := strings.Split(pwd, pt.env.PathSeperator())
|
splitted := strings.Split(pwd, pt.env.PathSeparator())
|
||||||
rootLocation := splitted[0]
|
rootLocation := splitted[0]
|
||||||
return rootLocation
|
return rootLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pt *Path) pathDepth(pwd string) int {
|
func (pt *Path) pathDepth(pwd string) int {
|
||||||
splitted := strings.Split(pwd, pt.env.PathSeperator())
|
splitted := strings.Split(pwd, pt.env.PathSeparator())
|
||||||
depth := 0
|
depth := 0
|
||||||
for _, part := range splitted {
|
for _, part := range splitted {
|
||||||
if part != "" {
|
if part != "" {
|
||||||
|
|
|
@ -75,18 +75,18 @@ func TestRootLocationHome(t *testing.T) {
|
||||||
HomePath string
|
HomePath string
|
||||||
Pswd string
|
Pswd string
|
||||||
Pwd string
|
Pwd string
|
||||||
PathSeperator string
|
PathSeparator string
|
||||||
HomeIcon string
|
HomeIcon string
|
||||||
RegistryIcon string
|
RegistryIcon string
|
||||||
}{
|
}{
|
||||||
{Expected: "~", HomeIcon: "~", HomePath: "/home/bill/", Pwd: "/home/bill/", PathSeperator: "/"},
|
{Expected: "~", HomeIcon: "~", HomePath: "/home/bill/", Pwd: "/home/bill/", PathSeparator: "/"},
|
||||||
{Expected: "usr", HomePath: "/home/bill/", Pwd: "/usr/error/what", PathSeperator: "/"},
|
{Expected: "usr", HomePath: "/home/bill/", Pwd: "/usr/error/what", PathSeparator: "/"},
|
||||||
{Expected: "C:", HomePath: "C:\\Users\\Bill", Pwd: "C:\\Program Files\\Go", PathSeperator: "\\"},
|
{Expected: "C:", HomePath: "C:\\Users\\Bill", Pwd: "C:\\Program Files\\Go", PathSeparator: "\\"},
|
||||||
{Expected: "REG", RegistryIcon: "REG", HomePath: "C:\\Users\\Bill", Pwd: "HKCU:\\Program Files\\Go", PathSeperator: "\\"},
|
{Expected: "REG", RegistryIcon: "REG", HomePath: "C:\\Users\\Bill", Pwd: "HKCU:\\Program Files\\Go", PathSeparator: "\\"},
|
||||||
{Expected: "~", HomeIcon: "~", HomePath: "C:\\Users\\Bill", Pwd: "Microsoft.PowerShell.Core\\FileSystem::C:\\Users\\Bill", PathSeperator: "\\"},
|
{Expected: "~", HomeIcon: "~", HomePath: "C:\\Users\\Bill", Pwd: "Microsoft.PowerShell.Core\\FileSystem::C:\\Users\\Bill", PathSeparator: "\\"},
|
||||||
{Expected: "C:", HomePath: "C:\\Users\\Jack", Pwd: "Microsoft.PowerShell.Core\\FileSystem::C:\\Users\\Bill", PathSeperator: "\\"},
|
{Expected: "C:", HomePath: "C:\\Users\\Jack", Pwd: "Microsoft.PowerShell.Core\\FileSystem::C:\\Users\\Bill", PathSeparator: "\\"},
|
||||||
{Expected: "", HomePath: "C:\\Users\\Jack", Pwd: "", PathSeperator: "\\"},
|
{Expected: "", HomePath: "C:\\Users\\Jack", Pwd: "", PathSeparator: "\\"},
|
||||||
{Expected: "DRIVE:", HomePath: "/home/bill/", Pwd: "/usr/error/what", Pswd: "DRIVE:", PathSeperator: "/"},
|
{Expected: "DRIVE:", HomePath: "/home/bill/", Pwd: "/usr/error/what", Pswd: "DRIVE:", PathSeparator: "/"},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
|
@ -96,7 +96,7 @@ func TestRootLocationHome(t *testing.T) {
|
||||||
PSWD: &tc.Pswd,
|
PSWD: &tc.Pswd,
|
||||||
}
|
}
|
||||||
env.On("Args").Return(args)
|
env.On("Args").Return(args)
|
||||||
env.On("PathSeperator").Return(tc.PathSeperator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
path := &Path{
|
path := &Path{
|
||||||
env: env,
|
env: env,
|
||||||
|
@ -127,7 +127,7 @@ func TestPathDepthMultipleLevelsDeep(t *testing.T) {
|
||||||
pwd += levelDir
|
pwd += levelDir
|
||||||
}
|
}
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
env.On("getRunteGOOS").Return("")
|
env.On("getRunteGOOS").Return("")
|
||||||
path := &Path{
|
path := &Path{
|
||||||
env: env,
|
env: env,
|
||||||
|
@ -139,7 +139,7 @@ func TestPathDepthMultipleLevelsDeep(t *testing.T) {
|
||||||
func TestPathDepthZeroLevelsDeep(t *testing.T) {
|
func TestPathDepthZeroLevelsDeep(t *testing.T) {
|
||||||
pwd := "/usr/"
|
pwd := "/usr/"
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
path := &Path{
|
path := &Path{
|
||||||
env: env,
|
env: env,
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ func TestPathDepthZeroLevelsDeep(t *testing.T) {
|
||||||
func TestPathDepthOneLevelDeep(t *testing.T) {
|
func TestPathDepthOneLevelDeep(t *testing.T) {
|
||||||
pwd := "/usr/location"
|
pwd := "/usr/location"
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
path := &Path{
|
path := &Path{
|
||||||
env: env,
|
env: env,
|
||||||
}
|
}
|
||||||
|
@ -164,32 +164,32 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
HomePath string
|
HomePath string
|
||||||
Pswd string
|
Pswd string
|
||||||
Pwd string
|
Pwd string
|
||||||
PathSeperator string
|
PathSeparator string
|
||||||
HomeIcon string
|
HomeIcon string
|
||||||
FolderSeparatorIcon string
|
FolderSeparatorIcon string
|
||||||
Style string
|
Style string
|
||||||
GOOS string
|
GOOS string
|
||||||
MaxDepth int
|
MaxDepth int
|
||||||
}{
|
}{
|
||||||
{Style: AgnosterFull, Expected: "usr > location > whatever", HomePath: "/usr/home", Pwd: "/usr/location/whatever", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterFull, Expected: "usr > location > whatever", HomePath: "/usr/home", Pwd: "/usr/location/whatever", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "usr > .. > man", HomePath: "/usr/home", Pwd: "/usr/location/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "usr > .. > man", HomePath: "/usr/home", Pwd: "/usr/location/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "~ > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "~ > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "~ > projects", HomePath: "/usr/home", Pwd: "/usr/home/projects", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "~ > projects", HomePath: "/usr/home", Pwd: "/usr/home/projects", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "C:", HomePath: homeBillWindows, Pwd: "C:", PathSeperator: "\\", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "C:", HomePath: homeBillWindows, Pwd: "C:", PathSeparator: "\\", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "/", HomePath: homeBillWindows, Pwd: "/", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "/", HomePath: homeBillWindows, Pwd: "/", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: AgnosterShort, Expected: "foo", HomePath: homeBillWindows, Pwd: "/foo", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: AgnosterShort, Expected: "foo", HomePath: homeBillWindows, Pwd: "/foo", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
|
|
||||||
{Style: AgnosterShort, Expected: "usr > .. > bar > man", HomePath: "/usr/home", Pwd: "/usr/foo/bar/man", PathSeperator: "/", FolderSeparatorIcon: " > ", MaxDepth: 2},
|
{Style: AgnosterShort, Expected: "usr > .. > bar > man", HomePath: "/usr/home", Pwd: "/usr/foo/bar/man", PathSeparator: "/", FolderSeparatorIcon: " > ", MaxDepth: 2},
|
||||||
{Style: AgnosterShort, Expected: "usr > foo > bar > man", HomePath: "/usr/home", Pwd: "/usr/foo/bar/man", PathSeperator: "/", FolderSeparatorIcon: " > ", MaxDepth: 3},
|
{Style: AgnosterShort, Expected: "usr > foo > bar > man", HomePath: "/usr/home", Pwd: "/usr/foo/bar/man", PathSeparator: "/", FolderSeparatorIcon: " > ", MaxDepth: 3},
|
||||||
{Style: AgnosterShort, Expected: "~ > .. > bar > man", HomePath: "/usr/home", Pwd: "/usr/home/foo/bar/man", PathSeperator: "/", FolderSeparatorIcon: " > ", MaxDepth: 2},
|
{Style: AgnosterShort, Expected: "~ > .. > bar > man", HomePath: "/usr/home", Pwd: "/usr/home/foo/bar/man", PathSeparator: "/", FolderSeparatorIcon: " > ", MaxDepth: 2},
|
||||||
{Style: AgnosterShort, Expected: "~ > foo > bar > man", HomePath: "/usr/home", Pwd: "/usr/home/foo/bar/man", PathSeperator: "/", FolderSeparatorIcon: " > ", MaxDepth: 3},
|
{Style: AgnosterShort, Expected: "~ > foo > bar > man", HomePath: "/usr/home", Pwd: "/usr/home/foo/bar/man", PathSeparator: "/", FolderSeparatorIcon: " > ", MaxDepth: 3},
|
||||||
|
|
||||||
{
|
{
|
||||||
Style: AgnosterShort,
|
Style: AgnosterShort,
|
||||||
Expected: "C: > .. > bar > man",
|
Expected: "C: > .. > bar > man",
|
||||||
HomePath: homeBillWindows,
|
HomePath: homeBillWindows,
|
||||||
Pwd: "C:\\usr\\foo\\bar\\man",
|
Pwd: "C:\\usr\\foo\\bar\\man",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxDepth: 2,
|
MaxDepth: 2,
|
||||||
},
|
},
|
||||||
|
@ -198,7 +198,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
Expected: "C: > .. > foo > bar > man",
|
Expected: "C: > .. > foo > bar > man",
|
||||||
HomePath: homeBillWindows,
|
HomePath: homeBillWindows,
|
||||||
Pwd: "C:\\usr\\foo\\bar\\man",
|
Pwd: "C:\\usr\\foo\\bar\\man",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxDepth: 3,
|
MaxDepth: 3,
|
||||||
},
|
},
|
||||||
|
@ -207,7 +207,7 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
Expected: "~ > .. > bar > man",
|
Expected: "~ > .. > bar > man",
|
||||||
HomePath: homeBillWindows,
|
HomePath: homeBillWindows,
|
||||||
Pwd: "C:\\Users\\Bill\\foo\\bar\\man",
|
Pwd: "C:\\Users\\Bill\\foo\\bar\\man",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxDepth: 2,
|
MaxDepth: 2,
|
||||||
},
|
},
|
||||||
|
@ -216,36 +216,36 @@ func TestAgnosterPathStyles(t *testing.T) {
|
||||||
Expected: "~ > foo > bar > man",
|
Expected: "~ > foo > bar > man",
|
||||||
HomePath: homeBillWindows,
|
HomePath: homeBillWindows,
|
||||||
Pwd: "C:\\Users\\Bill\\foo\\bar\\man",
|
Pwd: "C:\\Users\\Bill\\foo\\bar\\man",
|
||||||
PathSeperator: "\\",
|
PathSeparator: "\\",
|
||||||
FolderSeparatorIcon: " > ",
|
FolderSeparatorIcon: " > ",
|
||||||
MaxDepth: 3,
|
MaxDepth: 3,
|
||||||
},
|
},
|
||||||
|
|
||||||
{Style: AgnosterFull, Expected: "PSDRIVE: | src", HomePath: homeBillWindows, Pwd: "/foo", Pswd: "PSDRIVE:/src", PathSeperator: "/", FolderSeparatorIcon: " | "},
|
{Style: AgnosterFull, Expected: "PSDRIVE: | src", HomePath: homeBillWindows, Pwd: "/foo", Pswd: "PSDRIVE:/src", PathSeparator: "/", FolderSeparatorIcon: " | "},
|
||||||
{Style: AgnosterShort, Expected: "PSDRIVE: | .. | init", HomePath: homeBillWindows, Pwd: "/foo", Pswd: "PSDRIVE:/src/init", PathSeperator: "/", FolderSeparatorIcon: " | "},
|
{Style: AgnosterShort, Expected: "PSDRIVE: | .. | init", HomePath: homeBillWindows, Pwd: "/foo", Pswd: "PSDRIVE:/src/init", PathSeparator: "/", FolderSeparatorIcon: " | "},
|
||||||
|
|
||||||
{Style: Mixed, Expected: "~ > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Mixed, Expected: "~ > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Mixed, Expected: "~ > ab > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Mixed, Expected: "~ > ab > .. > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
|
|
||||||
{Style: Letter, Expected: "~ > a > w > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "~ > a > w > man", HomePath: "/usr/home", Pwd: "/usr/home/ab/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/burp/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/burp/ab/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > a > w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > a > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > a > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > a > ._w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/._whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > a > ._w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/ab/._whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .ä > ū > .w > man", HomePath: "/usr/home", Pwd: "/usr/.äufbau/ūmgebung/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .ä > ū > .w > man", HomePath: "/usr/home", Pwd: "/usr/.äufbau/ūmgebung/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > 1 > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/12345/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > 1 > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/12345/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > 1 > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/12345abc/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > 1 > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/12345abc/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "u > .b > __p > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/__pycache__/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "u > .b > __p > .w > man", HomePath: "/usr/home", Pwd: "/usr/.burp/__pycache__/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "➼ > .w > man", HomePath: "/usr/home", Pwd: "➼/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "➼ > .w > man", HomePath: "/usr/home", Pwd: "➼/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Letter, Expected: "➼ s > .w > man", HomePath: "/usr/home", Pwd: "➼ something/.whatever/man", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Letter, Expected: "➼ s > .w > man", HomePath: "/usr/home", Pwd: "➼ something/.whatever/man", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
|
|
||||||
{Style: Unique, Expected: "~ > a > ab > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/abc/abcd", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Unique, Expected: "~ > a > ab > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/abc/abcd", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Unique, Expected: "~ > a > .a > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/.abc/abcd", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Unique, Expected: "~ > a > .a > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/.abc/abcd", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
{Style: Unique, Expected: "~ > a > ab > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/ab/abcd", PathSeperator: "/", FolderSeparatorIcon: " > "},
|
{Style: Unique, Expected: "~ > a > ab > abcd", HomePath: "/usr/home", Pwd: "/usr/home/ab/ab/abcd", PathSeparator: "/", FolderSeparatorIcon: " > "},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return(tc.PathSeperator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("Home").Return(tc.HomePath)
|
env.On("Home").Return(tc.HomePath)
|
||||||
env.On("Pwd").Return(tc.Pwd)
|
env.On("Pwd").Return(tc.Pwd)
|
||||||
env.On("GOOS").Return(tc.GOOS)
|
env.On("GOOS").Return(tc.GOOS)
|
||||||
|
@ -366,7 +366,7 @@ func TestGetFullPath(t *testing.T) {
|
||||||
if len(tc.PathSeparator) == 0 {
|
if len(tc.PathSeparator) == 0 {
|
||||||
tc.PathSeparator = "/"
|
tc.PathSeparator = "/"
|
||||||
}
|
}
|
||||||
env.On("PathSeperator").Return(tc.PathSeparator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("Pwd").Return(tc.Pwd)
|
env.On("Pwd").Return(tc.Pwd)
|
||||||
env.On("GOOS").Return(tc.GOOS)
|
env.On("GOOS").Return(tc.GOOS)
|
||||||
|
@ -417,7 +417,7 @@ func TestGetFullPathCustomMappedLocations(t *testing.T) {
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("Pwd").Return(tc.Pwd)
|
env.On("Pwd").Return(tc.Pwd)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
|
@ -468,7 +468,7 @@ func TestNormalizePath(t *testing.T) {
|
||||||
func TestGetFolderPathCustomMappedLocations(t *testing.T) {
|
func TestGetFolderPathCustomMappedLocations(t *testing.T) {
|
||||||
pwd := "/a/b/c/d"
|
pwd := "/a/b/c/d"
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("Pwd").Return(pwd)
|
env.On("Pwd").Return(pwd)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
|
@ -516,7 +516,7 @@ func TestAgnosterPath(t *testing.T) { // nolint:dupl
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("Home").Return(tc.Home)
|
env.On("Home").Return(tc.Home)
|
||||||
env.On("PathSeperator").Return(tc.PathSeparator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("Pwd").Return(tc.PWD)
|
env.On("Pwd").Return(tc.PWD)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
args := &environment.Args{
|
args := &environment.Args{
|
||||||
|
@ -564,7 +564,7 @@ func TestAgnosterLeftPath(t *testing.T) { // nolint:dupl
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("Home").Return(tc.Home)
|
env.On("Home").Return(tc.Home)
|
||||||
env.On("PathSeperator").Return(tc.PathSeparator)
|
env.On("PathSeparator").Return(tc.PathSeparator)
|
||||||
env.On("Pwd").Return(tc.PWD)
|
env.On("Pwd").Return(tc.PWD)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
args := &environment.Args{
|
args := &environment.Args{
|
||||||
|
@ -611,7 +611,7 @@ func TestGetPwd(t *testing.T) {
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
env.On("Pwd").Return(tc.Pwd)
|
env.On("Pwd").Return(tc.Pwd)
|
||||||
env.On("GOOS").Return("")
|
env.On("GOOS").Return("")
|
||||||
|
|
|
@ -52,7 +52,7 @@ func TestPythonTemplate(t *testing.T) {
|
||||||
env.On("Getenv", "CONDA_ENV_PATH").Return(tc.VirtualEnvName)
|
env.On("Getenv", "CONDA_ENV_PATH").Return(tc.VirtualEnvName)
|
||||||
env.On("Getenv", "CONDA_DEFAULT_ENV").Return(tc.VirtualEnvName)
|
env.On("Getenv", "CONDA_DEFAULT_ENV").Return(tc.VirtualEnvName)
|
||||||
env.On("Getenv", "PYENV_VERSION").Return(tc.VirtualEnvName)
|
env.On("Getenv", "PYENV_VERSION").Return(tc.VirtualEnvName)
|
||||||
env.On("PathSeperator").Return("")
|
env.On("PathSeparator").Return("")
|
||||||
env.On("Pwd").Return("/usr/home/project")
|
env.On("Pwd").Return("/usr/home/project")
|
||||||
env.On("Home").Return("/usr/home")
|
env.On("Home").Return("/usr/home")
|
||||||
props := properties.Map{
|
props := properties.Map{
|
||||||
|
@ -80,7 +80,7 @@ func TestPythonPythonInContext(t *testing.T) {
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("")
|
env.On("PathSeparator").Return("")
|
||||||
env.On("Getenv", "VIRTUAL_ENV").Return(tc.VirtualEnvName)
|
env.On("Getenv", "VIRTUAL_ENV").Return(tc.VirtualEnvName)
|
||||||
env.On("Getenv", "CONDA_ENV_PATH").Return("")
|
env.On("Getenv", "CONDA_ENV_PATH").Return("")
|
||||||
env.On("Getenv", "CONDA_DEFAULT_ENV").Return("")
|
env.On("Getenv", "CONDA_DEFAULT_ENV").Return("")
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestTextSegment(t *testing.T) {
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(mock.MockedEnvironment)
|
env := new(mock.MockedEnvironment)
|
||||||
env.On("PathSeperator").Return("/")
|
env.On("PathSeparator").Return("/")
|
||||||
env.On("TemplateCache").Return(&environment.TemplateCache{
|
env.On("TemplateCache").Return(&environment.TemplateCache{
|
||||||
UserName: "Posh",
|
UserName: "Posh",
|
||||||
Env: map[string]string{
|
Env: map[string]string{
|
||||||
|
|
Loading…
Reference in a new issue