๐Ÿ’พ Archived View for source.community โ€บ ckaznocha โ€บ gemini โ€บ blob โ€บ main โ€บ url_test.go captured on 2024-05-10 at 11:05:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2024-02-05)

-=-=-=-=-=-=-

                                                         .
,-. ,-. . . ,-. ,-. ,-.    ,-. ,-. ,-,-. ,-,-. . . ,-. . |- . .
`-. | | | | |   |   |-'    |   | | | | | | | | | | | | | |  | |
`-' `-' `-^ '   `-' `-' :: `-' `-' ' ' ' ' ' ' `-^ ' ' ' `' `-|
                                                             /|
                                                            `-'

Profile for ckaznocha

ckaznocha / gemini

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

Branches

Log

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

ยฉ 2024 source.community