mirror of
https://github.com/kovetskiy/mark.git
synced 2026-05-02 05:12:35 +00:00
*: Reorganize code
This commit is contained in:
30
metadata/metadata_test.go
Normal file
30
metadata/metadata_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package metadata
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestExtractDocumentLeadingH1(t *testing.T) {
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
dir := path.Join(path.Dir(filename), "..")
|
||||
err := os.Chdir(dir)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
filename = "testdata/header.md"
|
||||
|
||||
markdown, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
actual := ExtractDocumentLeadingH1(markdown)
|
||||
|
||||
assert.Equal(t, "a", actual)
|
||||
}
|
||||
Reference in New Issue
Block a user