Adding upstream version 3.10.8.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
37e9b6d587
commit
03bfe4079e
356 changed files with 28857 additions and 0 deletions
38
cmd/testhelpers.go
Normal file
38
cmd/testhelpers.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright Earl Warren <contact@earl-warren.org>
|
||||
// Copyright Loïc Dachary <loic@dachary.org>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.forgejo.org/f3/gof3/v3/logger"
|
||||
// allow forges to register
|
||||
_ "code.forgejo.org/f3/gof3/v3/forges/filesystem"
|
||||
_ "code.forgejo.org/f3/gof3/v3/forges/forgejo"
|
||||
)
|
||||
|
||||
func runApp(ctx context.Context, args ...string) (string, error) {
|
||||
l := logger.NewCaptureLogger()
|
||||
ctx = logger.ContextSetLogger(ctx, l)
|
||||
|
||||
app := NewApp()
|
||||
|
||||
app.Writer = l.GetBuffer()
|
||||
app.ErrWriter = l.GetBuffer()
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Println(l.String())
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
|
||||
err := app.Run(ctx, args)
|
||||
|
||||
fmt.Println(l.String())
|
||||
|
||||
return l.String(), err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue