1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

formatting

This commit is contained in:
JanHoefelmeyer 2023-09-08 13:34:45 +02:00
parent daab24eb2f
commit 3a7b411789
3 changed files with 17 additions and 22 deletions

View file

@ -28,7 +28,7 @@ func TestNewPatternMatcher(t *testing.T) {
// Matches returns true if the given string matches any of the expressions.
func TestMatches(t *testing.T) {
regex := []string{"a"}
regex := []string{"a"}
pm, _ := NewPatternMatcher(regex)
if !pm.Matches("a") {
t.Errorf("Failure: Did not match two identical strings")

View file

@ -9,15 +9,14 @@
package misc
import (
"testing"
"bytes"
"mime/multipart"
"testing"
)
// CreateFormFile creates an [io.Writer] like [mime/multipart.Writer.CreateFromFile].
// This version allows to set the mime type, too.
func TestCreateFormFile( t *testing.T) {
func TestCreateFormFile(t *testing.T) {
body := new(bytes.Buffer)
writer := multipart.NewWriter(body)

View file

@ -10,12 +10,10 @@
package models
import (
"time"
"testing"
"time"
)
func TestNewTimeInterval(t *testing.T) {
var before time.Time
before = time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
@ -24,7 +22,6 @@ func TestNewTimeInterval(t *testing.T) {
NewTimeInterval(after, before)
}
func TestGuessDate(t *testing.T) {
if _, guess := guessDate("2006-01-02T15:04:05"); !guess {
t.Errorf("Failure: Could not guess valid Date from valid string")
@ -34,7 +31,6 @@ func TestGuessDate(t *testing.T) {
}
}
func TestUnmarshalText(t *testing.T) {
testTimeRange := NewTimeInterval(
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
@ -51,17 +47,17 @@ func TestUnmarshalText(t *testing.T) {
func TestMarshalJSON(t *testing.T) {
testTimeRange := NewTimeInterval(
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC))
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC))
testTimeRange.MarshalJSON()
}
func TestUnmarshalFlag(t *testing.T){
func TestUnmarshalFlag(t *testing.T) {
testTimeRange := NewTimeInterval(
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC))
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC))
if err := testTimeRange.UnmarshalFlag("3h"); err != nil {
t.Errorf(err.Error())
t.Errorf(err.Error())
}
if err := testTimeRange.UnmarshalFlag("2006-01-02T15:04:05"); err != nil {
t.Errorf(err.Error())
@ -84,6 +80,6 @@ func TestContains(t *testing.T) {
testTimeRange := NewTimeInterval(
time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC),
time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC))
testPointInTime := time.Date(2010, time.March, 10, 23, 0, 0, 0, time.UTC)
testPointInTime := time.Date(2010, time.March, 10, 23, 0, 0, 0, time.UTC)
testTimeRange.Contains(testPointInTime)
}