mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
48 lines
899 B
Go
48 lines
899 B
Go
// Copyright 2026 Hanzo AI, Inc. 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 <[email protected]> 12345 +0100",
|
|
want: &Signature{
|
|
Name: "a b",
|
|
Email: "[email protected]",
|
|
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 <[email protected]>",
|
|
want: &Signature{Name: "bad-line <[email protected]>"},
|
|
},
|
|
}
|
|
for _, test := range tests {
|
|
got := parseSignatureFromCommitLine(test.line)
|
|
assert.Equal(t, test.want, got)
|
|
}
|
|
}
|