mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-09-06 22:33:14 +00:00
22 lines
538 B
Go
22 lines
538 B
Go
|
// Copyright 2023 The Forgejo Authors. All rights reserved.
|
||
|
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"regexp"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func Test_splitEnvironmentVariable(t *testing.T) {
|
||
|
prefixRegexp := regexp.MustCompile(EnvironmentPrefix + "__")
|
||
|
k, v := splitEnvironmentVariable(prefixRegexp, "FORGEJO__KEY=VALUE")
|
||
|
assert.Equal(t, k, "KEY")
|
||
|
assert.Equal(t, v, "VALUE")
|
||
|
k, v = splitEnvironmentVariable(prefixRegexp, "nothing=interesting")
|
||
|
assert.Equal(t, k, "")
|
||
|
assert.Equal(t, v, "")
|
||
|
}
|