-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6b821b
commit 6df820b
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Go | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.x' | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Build | ||
run: go build -v ./... | ||
- name: Test with the Go CLI | ||
run: go test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestParseFrontMatter(t *testing.T) { | ||
p := &Page{ | ||
Path: "example/content/index.md", | ||
} | ||
|
||
if err := parseFrontMatter(p); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
expectedTitle := "My site" | ||
if p.Title != expectedTitle { | ||
t.Errorf("Invalid title. Expected %v, got %v", expectedTitle, p.Title) | ||
} | ||
} | ||
|
||
func TestParseContent(t *testing.T) { | ||
p := &Page{ | ||
Path: "example/content/index.md", | ||
} | ||
|
||
content, err := p.ParseContent() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if !strings.Contains(content, "<p>Hey, welcome on my site!</p>") { | ||
t.Errorf("Invalid content. Got %v", content) | ||
} | ||
|
||
} |