11package poetry
22
33import (
4+ "context"
45 _ "embed"
56 "fmt"
7+ "os"
8+ "path/filepath"
69 "github.com/pelletier/go-toml/v2"
710 "github.com/stretchr/testify/assert"
811 "testing"
@@ -27,3 +30,22 @@ func TestParsePoetryLock(t *testing.T) {
2730 assert .Equal (t , 13 , len (root .Get ("package" ).AsArray ()))
2831 assert .Equal (t , "main" , root .Get ("package" ).AsArray ()[0 ].Get ("category" ).v )
2932}
33+
34+ //go:embed uv.lock
35+ var __uvLockData []byte
36+
37+ func TestParseUvLock (t * testing.T ) {
38+ dir := t .TempDir ()
39+ uvLockPath := filepath .Join (dir , "uv.lock" )
40+ assert .NoError (t , os .WriteFile (uvLockPath , __uvLockData , 0o600 ))
41+
42+ deps , e := parsePoetryLock (context .Background (), uvLockPath )
43+ assert .NoError (t , e )
44+ assert .Equal (t , 3 , len (deps ))
45+ assert .Equal (t , "annotated-types" , deps [0 ].CompName )
46+ assert .Equal (t , "0.7.0" , deps [0 ].CompVersion )
47+ assert .Equal (t , "anyio" , deps [1 ].CompName )
48+ assert .Equal (t , "4.10.0" , deps [1 ].CompVersion )
49+ assert .Equal (t , "idna" , deps [2 ].CompName )
50+ assert .Equal (t , "3.10" , deps [2 ].CompVersion )
51+ }
0 commit comments