forked from coop-cloud-mirrors/godotenv
Compare commits
3 Commits
v1.5.1
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
805932dc80 | |||
e3b6eee84d | |||
193c9aba29 |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -12,9 +12,9 @@ jobs:
|
|||||||
os: [ ubuntu-latest, macOS-latest, windows-latest ]
|
os: [ ubuntu-latest, macOS-latest, windows-latest ]
|
||||||
name: ${{ matrix.os }} Go ${{ matrix.go }} Tests
|
name: ${{ matrix.os }} Go ${{ matrix.go }} Tests
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- run: go test
|
- run: go test
|
||||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Generate build files
|
- name: Generate build files
|
||||||
uses: thatisuday/go-cross-build@v1.0.2
|
uses: thatisuday/go-cross-build@v1.0.2
|
||||||
with:
|
with:
|
||||||
|
@ -573,3 +573,64 @@ func TestTrailingNewlines(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWhitespace(t *testing.T) {
|
||||||
|
cases := map[string]struct {
|
||||||
|
input string
|
||||||
|
key string
|
||||||
|
value string
|
||||||
|
}{
|
||||||
|
"Leading whitespace": {
|
||||||
|
input: " A=a\n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Leading tab": {
|
||||||
|
input: "\tA=a\n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Leading mixed whitespace": {
|
||||||
|
input: " \t \t\n\t \t A=a\n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Leading whitespace before export": {
|
||||||
|
input: " \t\t export A=a\n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Trailing whitespace": {
|
||||||
|
input: "A=a \t \t\n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Trailing whitespace with export": {
|
||||||
|
input: "export A=a\t \t \n",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"No EOL": {
|
||||||
|
input: "A=a",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
"Trailing whitespace with no EOL": {
|
||||||
|
input: "A=a ",
|
||||||
|
key: "A",
|
||||||
|
value: "a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for n, c := range cases {
|
||||||
|
t.Run(n, func(t *testing.T) {
|
||||||
|
result, err := Unmarshal(c.input)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Input: %q Unexpected error:\t%q", c.input, err)
|
||||||
|
}
|
||||||
|
if result[c.key] != c.value {
|
||||||
|
t.Errorf("Input %q Expected:\t %q/%q\nGot:\t %q", c.input, c.key, c.value, result)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user