Skip to content

Commit

Permalink
.github: add a go workflow for building and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
toru committed Oct 3, 2024
1 parent 4f2a8a1 commit 7097efd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Go

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.23.0

- name: Examine
run: go vet ./...

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
7 changes: 5 additions & 2 deletions radixdb_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package radixdb

import "testing"
import (
"bytes"
"testing"
)

func TestLongestCommonPrefix(t *testing.T) {
tests := []struct {
Expand All @@ -22,7 +25,7 @@ func TestLongestCommonPrefix(t *testing.T) {
for _, test := range tests {
subject := longestCommonPrefix(test.a, test.b)

if string(subject) != string(test.expected) {
if !bytes.Equal(subject, test.expected) {
t.Errorf("(%q,%q): got:%q, want:%q", test.a, test.b, subject, test.expected)
}
}
Expand Down

0 comments on commit 7097efd

Please sign in to comment.