From 083c3ee659c6c5542687f3bafae68cbc24dbc90f Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Sat, 25 Jun 2022 18:07:39 +0800 Subject: db: refactor "action" table to use GORM (#7054) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- internal/testutil/testutil.go | 13 +++++++++++++ internal/testutil/testutil_test.go | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 internal/testutil/testutil.go create mode 100644 internal/testutil/testutil_test.go (limited to 'internal/testutil') diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go new file mode 100644 index 00000000..c7c1bba2 --- /dev/null +++ b/internal/testutil/testutil.go @@ -0,0 +1,13 @@ +// Copyright 2022 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package testutil + +import ( + "os" + "strings" +) + +// InTest is ture if the current binary looks like a test artifact. +var InTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") diff --git a/internal/testutil/testutil_test.go b/internal/testutil/testutil_test.go new file mode 100644 index 00000000..5a6c1486 --- /dev/null +++ b/internal/testutil/testutil_test.go @@ -0,0 +1,15 @@ +// Copyright 2022 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package testutil + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestInTest(t *testing.T) { + assert.True(t, InTest) +} -- cgit v1.2.3