[ci-force] fix last

This commit is contained in:
Alexander Wang 2023-05-19 16:08:23 -07:00
parent 39682629f9
commit fe8efdf09e
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,8 @@ package d2oracle
import ( import (
"fmt" "fmt"
"oss.terrastruct.com/d2/d2ast"
"oss.terrastruct.com/d2/d2format"
"oss.terrastruct.com/d2/d2graph" "oss.terrastruct.com/d2/d2graph"
"oss.terrastruct.com/d2/d2parser" "oss.terrastruct.com/d2/d2parser"
) )
@ -97,5 +99,5 @@ func GetID(key string) string {
return "" return ""
} }
return mk.Key.Path[len(mk.Key.Path)-1].Unbox().ScalarString() return d2format.Format(d2ast.RawString(mk.Key.Path[len(mk.Key.Path)-1].Unbox().ScalarString(), true))
} }

View file

@ -18,3 +18,9 @@ func TestIsLabelKeyID(t *testing.T) {
assert.Equal(t, false, d2oracle.IsLabelKeyID("x", "y")) assert.Equal(t, false, d2oracle.IsLabelKeyID("x", "y"))
assert.Equal(t, false, d2oracle.IsLabelKeyID("x->y", "y")) assert.Equal(t, false, d2oracle.IsLabelKeyID("x->y", "y"))
} }
func TestGetID(t *testing.T) {
t.Parallel()
assert.Equal(t, `"y (z)"`, d2oracle.GetID(`y (z)`))
}