mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
26 lines
511 B
Go
26 lines
511 B
Go
|
package store
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestUtils(t *testing.T) {
|
||
|
a, b := splitFirstSegment("")
|
||
|
require.Equal(t, "", a)
|
||
|
require.Equal(t, "", b)
|
||
|
|
||
|
a, b = splitFirstSegment("hello")
|
||
|
require.Equal(t, "hello", a)
|
||
|
require.Equal(t, "", b)
|
||
|
|
||
|
a, b = splitFirstSegment("hello/world")
|
||
|
require.Equal(t, "hello", a)
|
||
|
require.Equal(t, "world", b)
|
||
|
|
||
|
a, b = splitFirstSegment("/hello/world") // strip leading slash
|
||
|
require.Equal(t, "hello", a)
|
||
|
require.Equal(t, "world", b)
|
||
|
}
|