๐Ÿ’พ Archived View for source.community โ€บ ckaznocha โ€บ gemini โ€บ blob โ€บ main โ€บ handler_test.go captured on 2024-08-18 at 18:02:09. 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

/handler_test.go (main)

โ†‘ /

blob

View raw contents of /handler_test.go (main)

โ”€โ”€โ”€โ”€โ•ฎ
   1โ”‚ package gemini_test
   2โ”‚ 
   3โ”‚ import (
   4โ”‚ 	"context"
   5โ”‚ 	"fmt"
   6โ”‚ 	"testing"
   7โ”‚ 
   8โ”‚ 	"source.community/ckaznocha/gemini"
   9โ”‚ 	"source.community/ckaznocha/gemini/geminitest"
  10โ”‚ )
  11โ”‚ 
  12โ”‚ func TestHandlerFunc_ServeGemini(t *testing.T) {
  13โ”‚ 	t.Parallel()
  14โ”‚ 
  15โ”‚ 	type args struct {
  16โ”‚ 		r *gemini.Request
  17โ”‚ 	}
  18โ”‚ 
  19โ”‚ 	tests := []struct {
  20โ”‚ 		name string
  21โ”‚ 		f    gemini.HandlerFunc
  22โ”‚ 		args args
  23โ”‚ 		want string
  24โ”‚ 	}{
  25โ”‚ 		{
  26โ”‚ 			name: "",
  27โ”‚ 			f: func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
  28โ”‚ 				fmt.Fprint(w.Success(ctx, ""), "Hello, Gemini!")
  29โ”‚ 			},
  30โ”‚ 			args: args{
  31โ”‚ 				r: geminitest.NewRequest("gemini://example.com/"),
  32โ”‚ 			},
  33โ”‚ 			want: "Hello, Gemini!",
  34โ”‚ 		},
  35โ”‚ 	}
  36โ”‚ 
  37โ”‚ 	for _, tt := range tests {
  38โ”‚ 		tt := tt
  39โ”‚ 		t.Run(tt.name, func(t *testing.T) {
  40โ”‚ 			t.Parallel()
  41โ”‚ 			recorder := geminitest.NewResponseRecorder()
  42โ”‚ 			tt.f.ServeGemini(context.Background(), recorder, tt.args.r)
  43โ”‚ 
  44โ”‚ 			if recorder.Body.String() != tt.want {
  45โ”‚ 				t.Errorf("HandlerFunc_ServeGemini() got = %v, want %v", recorder.Body.String(), tt.want)
  46โ”‚ 			}
  47โ”‚ 		})
  48โ”‚ 	}
  49โ”‚ }
โ”€โ”€โ”€โ”€โ•ฏ

ยท ยท ยท

๐Ÿก Home

FAQs

Privacy Policy

Terms & Conditions

Official Gemlog

info@source.community

ยฉ 2024 source.community