Skip to content

Commit

Permalink
Remove old test
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Aug 19, 2021
1 parent 7b7ec0a commit 7adfce8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- run: go build ./...
- run: go build ./...
working-directory: tests
- run: go test ./...
- run: go test --tags=postgres${{matrix.postgres}} ./...
working-directory: tests
env:
PG_USER: postgres
Expand Down
64 changes: 0 additions & 64 deletions tests/macaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,67 +67,3 @@ func TestMacaddr(t *testing.T) {
}
})
}

// https://www.postgresql.org/docs/current/datatype-net-types.html#DATATYPE-MACADDR8
func TestMacaddr8(t *testing.T) {
for _, addr := range []struct {
input string
output string
}{
{
"08:00:2b:01:02:03:04:05",
"08:00:2b:01:02:03:04:05",
},
{
"08-00-2b-01-02-03-04-05",
"08:00:2b:01:02:03:04:05",
},
{
"08002b:0102030405",
"08:00:2b:01:02:03:04:05",
},
{
"08002b-0102030405",
"08:00:2b:01:02:03:04:05",
},
{
"0800.2b01.0203.0405",
"08:00:2b:01:02:03:04:05",
},
{
"0800-2b01-0203-0405",
"08:00:2b:01:02:03:04:05",
},
{
"08002b01:02030405",
"08:00:2b:01:02:03:04:05",
},
{
"08002b0102030405",
"08:00:2b:01:02:03:04:05",
},
} {
addr = addr
t.Run(addr.input, func(t *testing.T) {
var cidr pqtype.Macaddr
if err := db.QueryRow(fmt.Sprintf(`SELECT '%s'::macaddr8`, addr.input)).Scan(&cidr); err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(true, cidr.Valid); diff != "" {
t.Errorf("valid mismatch (-want +got):\n%s", diff)
}
if diff := cmp.Diff(addr.output, cidr.Addr.String()); diff != "" {
t.Errorf("mismatch (-want +got):\n%s", diff)
}
})
}
t.Run("NULL", func(t *testing.T) {
var cidr pqtype.Macaddr
if err := db.QueryRow(fmt.Sprintf(`SELECT NULL::macaddr8`)).Scan(&cidr); err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(false, cidr.Valid); diff != "" {
t.Errorf("valid mismatch (-want +got):\n%s", diff)
}
})
}

0 comments on commit 7adfce8

Please sign in to comment.