File tree Expand file tree Collapse file tree
aws/logs_monitoring_go/internal/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ package model
77
88import (
99 "encoding/json"
10+ "slices"
1011 "testing"
1112)
1213
13- func TestTagsMarshalJSON (t * testing.T ) {
14+ func TestTags (t * testing.T ) {
1415 t .Parallel ()
1516
1617 tests := map [string ]struct {
@@ -40,11 +41,20 @@ func TestTagsMarshalJSON(t *testing.T) {
4041 t .Parallel ()
4142 got , err := json .Marshal (tc .tags )
4243 if err != nil {
43- t .Fatalf ("unexpected error: %v" , err )
44+ t .Fatalf ("unexpected marshal error: %v" , err )
4445 }
4546 if string (got ) != tc .want {
4647 t .Errorf ("got %s, want %s" , got , tc .want )
4748 }
49+
50+ var tags Tags
51+ err = json .Unmarshal (got , & tags )
52+ if err != nil {
53+ t .Fatalf ("unexpected unmarshal error: %v" , err )
54+ }
55+ if ! slices .Equal (tc .tags , tags ) {
56+ t .Errorf ("expected %v, got %v" , tc .tags , tags )
57+ }
4858 })
4959 }
5060}
You can’t perform that action at this time.
0 commit comments