// Copyright 2024 Matthew Rich . All rights reserved. package folio import ( "github.com/stretchr/testify/assert" "testing" "fmt" ) func TestURI(t *testing.T) { var file URI = URI(fmt.Sprintf("file://%s", TempDir)) u := file.Parse().URL() assert.Equal(t, "file", u.Scheme) assert.True(t, file.Exists()) file = URI(fmt.Sprintf("0file:_/%s", TempDir)) x := file.Parse() assert.Nil(t, x) } func TestURISetURL(t *testing.T) { var file URI = URI(fmt.Sprintf("file://%s", TempDir)) u := file.Parse().URL() var fileFromURL URI fileFromURL.SetURL(u) assert.Equal(t, fileFromURL, file) exttype, ext := file.Extension() assert.Equal(t, "", exttype) assert.Equal(t, "", ext) } func TestURINewResource(t *testing.T) { var file URI = URI(fmt.Sprintf("foo://%s", TempDir)) resource, err := file.NewResource(nil) assert.Nil(t, err) assert.NotNil(t, resource) }