mirror of
https://github.com/laravel-ls/uri
synced 2026-07-04 16:34:11 +02:00
uri: change Parse arg to s instead of uri
This commit is contained in:
parent
6d8f0e4dcb
commit
30fa9f7ed8
2 changed files with 5 additions and 5 deletions
4
uri.go
4
uri.go
|
|
@ -104,8 +104,8 @@ type State struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse parses and creates a new URI from uri.
|
// Parse parses and creates a new URI from uri.
|
||||||
func Parse(uri string) *URI {
|
func Parse(s string) *URI {
|
||||||
u, err := url.Parse(uri)
|
u, err := url.Parse(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("url.Parse: %#v\n", err))
|
panic(fmt.Sprintf("url.Parse: %#v\n", err))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@ import (
|
||||||
func TestParse(t *testing.T) {
|
func TestParse(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
uri string
|
s string
|
||||||
want *uri.URI
|
want *uri.URI
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Valid",
|
name: "Valid",
|
||||||
uri: "https://code.visualstudio.com/docs/extensions/overview#frag",
|
s: "https://code.visualstudio.com/docs/extensions/overview#frag",
|
||||||
want: &uri.URI{
|
want: &uri.URI{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Authority: "code.visualstudio.com",
|
Authority: "code.visualstudio.com",
|
||||||
|
|
@ -35,7 +35,7 @@ func TestParse(t *testing.T) {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
if diff := cmp.Diff(uri.Parse(tt.uri), tt.want); diff != "" {
|
if diff := cmp.Diff(uri.Parse(tt.s), tt.want); diff != "" {
|
||||||
t.Errorf("%s: (-got, +want)\n%s", tt.name, diff)
|
t.Errorf("%s: (-got, +want)\n%s", tt.name, diff)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue