tester

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package tester implements the codegen.test microservice.

The tester is used to test the code generator's functions.

Index

Constants

View Source
const Hostname = "codegen.test"

Hostname is the default hostname of the microservice: codegen.test.

View Source
const SourceCodeSHA256 = "736508152e55fa65f63846a87b0a1f681d82f4d2b080bbcd70857de5138bd469"
View Source
const Timestamp = "2024-08-01T15:49:23.376167Z"
View Source
const Version = 110

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock = intermediate.Mock

Mock is a mockable version of the codegen.test microservice, allowing functions, event sinks and web handlers to be mocked.

func NewMock

func NewMock() *Mock

New creates a new mockable version of the microservice.

type Service

type Service struct {
	*intermediate.Intermediate // DO NOT REMOVE
}

Service implements the codegen.test microservice.

The tester is used to test the code generator's functions.

func NewService

func NewService() *Service

NewService creates a new codegen.test microservice.

func (*Service) DirectoryServer

func (svc *Service) DirectoryServer(w http.ResponseWriter, r *http.Request) (err error)

DirectoryServer tests service resources given a greedy path argument.

func (*Service) Echo

func (svc *Service) Echo(w http.ResponseWriter, r *http.Request) (err error)

Echo tests a typical web handler.

func (*Service) FunctionPathArguments

func (svc *Service) FunctionPathArguments(ctx context.Context, named string, path2 string, suffix string) (joined string, err error)

FunctionPathArguments tests path arguments in functions.

func (*Service) Hello

func (svc *Service) Hello(w http.ResponseWriter, r *http.Request) (err error)

Hello prints hello in the language best matching the request's Accept-Language header.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service)) *Service

Init enables a single-statement pattern for initializing the microservice.

svc.Init(func(svc Service) {
	svc.SetGreeting("Hello")
})

func (*Service) LinesIntersection

func (svc *Service) LinesIntersection(ctx context.Context, l1 testerapi.XYLine, l2 *testerapi.XYLine) (b bool, err error)

LinesIntersection tests nested non-primitive types.

func (*Service) MultiValueHeaders

func (svc *Service) MultiValueHeaders(w http.ResponseWriter, r *http.Request) (err error)

MultiValueHeaders tests a passing in and returning headers with multiple values.

func (*Service) NonStringPathArguments

func (svc *Service) NonStringPathArguments(ctx context.Context, named int, path2 bool, suffix float64) (joined string, err error)

NonStringPathArguments tests path arguments that are not strings.

func (*Service) OnDiscoveredSink

func (svc *Service) OnDiscoveredSink(ctx context.Context, p testerapi.XYCoord, n int) (q testerapi.XYCoord, m int, err error)

OnDiscovered tests listening to events.

func (*Service) OnShutdown

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Service) PathArgumentsPriority

func (svc *Service) PathArgumentsPriority(ctx context.Context, foo string) (echo string, err error)

PathArgumentsPriority tests the priority of path arguments in functions.

func (*Service) PointDistance

func (svc *Service) PointDistance(ctx context.Context, p1 testerapi.XYCoord, p2 *testerapi.XYCoord) (d float64, err error)

PointDistance tests a function that takes non-primitive input arguments.

func (*Service) ShiftPoint

func (svc *Service) ShiftPoint(ctx context.Context, p *testerapi.XYCoord, x float64, y float64) (shifted *testerapi.XYCoord, err error)

ShiftPoint tests passing pointers of non-primitive types.

func (*Service) StringCut

func (svc *Service) StringCut(ctx context.Context, s string, sep string) (before string, after string, found bool, err error)

StringCut tests a function that takes primitive input arguments and returns primitive values.

func (*Service) SubArrayRange

func (svc *Service) SubArrayRange(ctx context.Context, httpRequestBody []int, min int, max int) (httpResponseBody []int, httpStatusCode int, err error)

SubArrayRange tests sending arguments as the entire request and response bodies. An httpRequestBody argument allows sending other arguments via query or path. An httpResponseBody argument prevents returning additional values, except for the status code.

func (*Service) SumTwoIntegers

func (svc *Service) SumTwoIntegers(ctx context.Context, x int, y int) (sum int, httpStatusCode int, err error)

SumTwoIntegers tests returning a status code from a function.

func (*Service) UnnamedFunctionPathArguments

func (svc *Service) UnnamedFunctionPathArguments(ctx context.Context, path1 string, path2 string, path3 string) (joined string, err error)

UnnamedFunctionPathArguments tests path arguments that are not named.

func (*Service) UnnamedWebPathArguments

func (svc *Service) UnnamedWebPathArguments(w http.ResponseWriter, r *http.Request) (err error)

UnnamedWebPathArguments tests path arguments that are not named.

func (*Service) WebPathArguments

func (svc *Service) WebPathArguments(w http.ResponseWriter, r *http.Request) (err error)

WebPathArguments tests path arguments in web handlers.

func (*Service) WhatTimeIsIt

func (svc *Service) WhatTimeIsIt(ctx context.Context) (t time.Time, err error)

WhatTimeIsIt tests shifting the clock.

Directories

Path Synopsis
app
Package intermediate serves as the foundation of the codegen.test microservice.
Package intermediate serves as the foundation of the codegen.test microservice.
Package testerapi implements the public API of the codegen.test microservice, including clients and data structures.
Package testerapi implements the public API of the codegen.test microservice, including clients and data structures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL