diff --git a/example_test.go b/example_test.go index 84b1b64..c6e1d2a 100644 --- a/example_test.go +++ b/example_test.go @@ -1,14 +1,12 @@ -package did_test +package did import ( "fmt" "log" - - "github.com/ockam-network/did" ) func ExampleParse() { - d, err := did.Parse("did:example:q7ckgxeq1lxmra0r") + d, err := Parse("did:example:q7ckgxeq1lxmra0r") if err != nil { log.Fatal(err) } @@ -17,7 +15,7 @@ func ExampleParse() { } func ExampleParse_withPath() { - d, err := did.Parse("did:example:q7ckgxeq1lxmra0r/a/b") + d, err := Parse("did:example:q7ckgxeq1lxmra0r/a/b") if err != nil { log.Fatal(err) } @@ -26,7 +24,7 @@ func ExampleParse_withPath() { } func ExampleParse_withFragment() { - d, err := did.Parse("did:example:q7ckgxeq1lxmra0r#keys-1") + d, err := Parse("did:example:q7ckgxeq1lxmra0r#keys-1") if err != nil { log.Fatal(err) } @@ -35,43 +33,43 @@ func ExampleParse_withFragment() { } func ExampleDID_String() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r"} - fmt.Println(d) + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r"} + fmt.Println(d.String()) // Output: did:example:q7ckgxeq1lxmra0r } func ExampleDID_String_withPath() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Path: "a/b"} + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Path: "a/b"} fmt.Println(d.String()) // Output: did:example:q7ckgxeq1lxmra0r/a/b } func ExampleDID_String_withPathSegments() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", PathSegments: []string{"a", "b"}} + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r", PathSegments: []string{"a", "b"}} fmt.Println(d.String()) // Output: did:example:q7ckgxeq1lxmra0r/a/b } func ExampleDID_String_withFragment() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Fragment: "keys-1"} - fmt.Println(d) + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Fragment: "keys-1"} + fmt.Println(d.String()) // Output: did:example:q7ckgxeq1lxmra0r#keys-1 } func ExampleDID_IsReference_withPath() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Path: "a/b"} + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Path: "a/b"} fmt.Println(d.IsReference()) // Output: true } func ExampleDID_IsReference_withFragment() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Fragment: "keys-1"} + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r", Fragment: "keys-1"} fmt.Println(d.IsReference()) // Output: true } func ExampleDID_IsReference_noPathOrFragment() { - d := &did.DID{Method: "example", ID: "q7ckgxeq1lxmra0r"} + d := &DID{Method: "example", ID: "q7ckgxeq1lxmra0r"} fmt.Println(d.IsReference()) // Output: false }