.
,-. ,-. . . ,-. ,-. ,-.    ,-. ,-. ,-,-. ,-,-. . . ,-. . |- . .
                                                             /|
                                                            `-'

=> Profile for ckaznocha

ckaznocha / gemini

A Go server implementation for the Gemini protocol.

git clone https://source.community/ckaznocha/gemini.git

=> โค๏ธ Likes (1)
=> ๐Ÿ™ Branches
=> ๐Ÿ“ Log
=> ๐ŸŒณ File Tree

/url_test.go (main)

=> โ†‘ /

Blob

=> View raw contents of /url_test.go (main)

โ”€โ”€โ”€โ”€โ•ฎ
   1โ”‚ package gemini_test
   2โ”‚ 
   3โ”‚ import (
   4โ”‚ 	"testing"
   5โ”‚ 
   6โ”‚ 	"source.community/ckaznocha/gemini"
   7โ”‚ )
   8โ”‚ 
   9โ”‚ func TestParseRequestURI(t *testing.T) {
  10โ”‚ 	t.Parallel()
  11โ”‚ 
  12โ”‚ 	type args struct {
  13โ”‚ 		rawURI string
  14โ”‚ 	}
  15โ”‚ 
  16โ”‚ 	tests := []struct {
  17โ”‚ 		want    *gemini.URI
  18โ”‚ 		name    string
  19โ”‚ 		args    args
  20โ”‚ 		wantErr bool
  21โ”‚ 	}{
  22โ”‚ 		{
  23โ”‚ 			name: "",
  24โ”‚ 			args: args{"gemini://example.com"},
  25โ”‚ 			want: &gemini.URI{
  26โ”‚ 				Host: "example.com",
  27โ”‚ 			},
  28โ”‚ 			wantErr: false,
  29โ”‚ 		},
  30โ”‚ 		{
  31โ”‚ 			name:    "url must be absolute",
  32โ”‚ 			args:    args{"/foo/bar"},
  33โ”‚ 			wantErr: true,
  34โ”‚ 		},
  35โ”‚ 		{
  36โ”‚ 			name:    "url cannot have a user",
  37โ”‚ 			args:    args{"gemini://foo:bar@example.com"},
  38โ”‚ 			wantErr: true,
  39โ”‚ 		},
  40โ”‚ 		{
  41โ”‚ 			name:    "url cannot be relative",
  42โ”‚ 			args:    args{"gemini:/foo/bar"},
  43โ”‚ 			wantErr: true,
  44โ”‚ 		},
  45โ”‚ 		{
  46โ”‚ 			name:    "url must be valid",
  47โ”‚ 			args:    args{"--()"},
  48โ”‚ 			wantErr: true,
  49โ”‚ 		},
  50โ”‚ 	}
  51โ”‚ 
  52โ”‚ 	for _, tt := range tests {
  53โ”‚ 		tt := tt
  54โ”‚ 		t.Run(tt.name, func(t *testing.T) {
  55โ”‚ 			t.Parallel()
  56โ”‚ 			got, err := gemini.ParseRequestURI(tt.args.rawURI)
  57โ”‚ 			if (err != nil) != tt.wantErr {
  58โ”‚ 				t.Errorf("ParseRequestURI() error = %v, wantErr %v", err, tt.wantErr)
  59โ”‚ 
  60โ”‚ 				return
  61โ”‚ 			}
  62โ”‚ 
  63โ”‚ 			if !tt.wantErr && got.String() != tt.want.String() {
  64โ”‚ 				t.Errorf("ParseRequestURI() = %v, want %v", got, tt.want)
  65โ”‚ 			}
  66โ”‚ 		})
  67โ”‚ 	}
  68โ”‚ }
โ”€โ”€โ”€โ”€โ•ฏ

ยท ยท ยท

=> ๐Ÿก Home | ๐Ÿ™‹ FAQs | ๐Ÿ•ต๏ธ Privacy Policy | ๐Ÿค Terms & Conditions | ๐Ÿ’Ž Official Gemlog | info@source.community

ยฉ 2025 source.community

Proxy Information
Original URL
gemini://source.community/ckaznocha/gemini/blob/main/url_test.go
Status Code
Success (20)
Meta
text/gemini; charset=utf-8; lang=en
Capsule Response Time
722.747422 milliseconds
Gemini-to-HTML Time
0.87491 milliseconds

This content has been proxied by September (3851b).