mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-19 21:49:28 +00:00
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
47 lines
903 B
Go
47 lines
903 B
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package git
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestParseSignatureFromCommitLine(t *testing.T) {
|
|
tests := []struct {
|
|
line string
|
|
want *Signature
|
|
}{
|
|
{
|
|
line: "a b <c@d.com> 12345 +0100",
|
|
want: &Signature{
|
|
Name: "a b",
|
|
Email: "c@d.com",
|
|
When: time.Unix(12345, 0).In(time.FixedZone("", 3600)),
|
|
},
|
|
},
|
|
{
|
|
line: "bad line",
|
|
want: &Signature{Name: "bad line"},
|
|
},
|
|
{
|
|
line: "bad < line",
|
|
want: &Signature{Name: "bad < line"},
|
|
},
|
|
{
|
|
line: "bad > line",
|
|
want: &Signature{Name: "bad > line"},
|
|
},
|
|
{
|
|
line: "bad-line <name@example.com>",
|
|
want: &Signature{Name: "bad-line <name@example.com>"},
|
|
},
|
|
}
|
|
for _, test := range tests {
|
|
got := parseSignatureFromCommitLine(test.line)
|
|
assert.Equal(t, test.want, got)
|
|
}
|
|
}
|