1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
diff --git a/hyperlink_test.go b/hyperlink_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..06e717f3104c0c718bd7a362b2697f140bf24705
--- /dev/null
+++ b/hyperlink_test.go
@@ -0,0 +1,21 @@
+package ansi
+
+import (
+ "fmt"
+ "net/url"
+ "testing"
+)
+
+func TestLink(t *testing.T) {
+ t.Run("url", func(t *testing.T) {
+ u, _ := url.Parse("https://example.com")
+
+ fmt.Printf("Link to example.com: %s\n", Link(*u, "Linktext"))
+ })
+ t.Run("string", func(t *testing.T) {
+ fmt.Printf("Link to my homepage: %s\n", LinkString("https://moritz.sh", "Linktext"))
+ })
+ t.Run("file", func(t *testing.T) {
+ fmt.Printf("Link to hyperlink_test.go: %s\n", LinkFile("hyperlink_test.go", "Linktext"))
+ })
+}
|