๐พ Archived View for source.community โบ ckaznocha โบ gemini โบ blob โบ main โบ handler_test.go captured on 2024-02-05 at 09:52:37. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2023-01-29)
-=-=-=-=-=-=-
. ,-. ,-. . . ,-. ,-. ,-. ,-. ,-. ,-,-. ,-,-. . . ,-. . |- . . `-. | | | | | | |-' | | | | | | | | | | | | | | | | | `-' `-' `-^ ' `-' `-' :: `-' `-' ' ' ' ' ' ' `-^ ' ' ' `' `-| /| `-'
git clone https://source.community/ckaznocha/gemini.git
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โ } โโโโโฏ
ยท ยท ยท
ยฉ 2024 source.community