File: env_tomap_windows_test.go

package info (click to toggle)
golang-github-caarlos0-env 11.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 240 kB
  • sloc: makefile: 29
file content (19 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//go:build windows

package env

import "testing"

// On Windows, environment variables can start with '='.
// This test verifies this behavior without relying on a Windows environment.
// See env_windows.go in the Go source: https://github.com/golang/go/blob/master/src/syscall/env_windows.go#L58
func TestToMapWindows(t *testing.T) {
	envVars := []string{"=::=::\\", "=C:=C:\\test", "VAR=REGULARVAR", "FOO=", "BAR"}
	result := ToMap(envVars)
	isEqual(t, map[string]string{
		"=::": "::\\",
		"=C:": "C:\\test",
		"VAR": "REGULARVAR",
		"FOO": "",
	}, result)
}