mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-14 23:14:05 -08:00
36 lines
839 B
Go
36 lines
839 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGetCodePoints(t *testing.T) {
|
|
codepoints, err := getGlyphCodePoints()
|
|
if connectionError, ok := err.(*ConnectionError); ok {
|
|
t.Log(connectionError.Error())
|
|
return
|
|
}
|
|
assert.Equal(t, 1939, len(codepoints))
|
|
}
|
|
|
|
func TestEscapeGlyphs(t *testing.T) {
|
|
cases := []struct {
|
|
Input string
|
|
Expected string
|
|
}{
|
|
{Input: "", Expected: "\\udb80\\ude4b"},
|
|
{Input: "a", Expected: "a"},
|
|
{Input: "\ue0b4", Expected: "\\ue0b4"},
|
|
{Input: "\ufd03", Expected: "\\ufd03"},
|
|
{Input: "}", Expected: "}"},
|
|
{Input: "🏚", Expected: "🏚"},
|
|
{Input: "\U000F011B", Expected: "\\udb80\\udd1b"},
|
|
{Input: "", Expected: "\\udb80\\udd1b"},
|
|
}
|
|
for _, tc := range cases {
|
|
assert.Equal(t, tc.Expected, escapeGlyphs(tc.Input, false), tc.Input)
|
|
}
|
|
}
|