Skip to content

Gomega Matchers for CSV Schema

License

Notifications You must be signed in to change notification settings

mikfreedman/gcsv

Repository files navigation

Go Report Card Go Build

Gomega matchers for CSV Schema

This package provides Gomega matchers to write assertions against Schema of a CSV:

RepresentSchema()

Verifies that an entire CSV matches the actual schema of an []interface{} array made up of the following basic types:

  • int
  • bool
  • float64
  • string

Note: Values for the actual schema are representative only and don't mean anything in and of themselves, they are just used for switching on type

import (
  . "github.com/mikfreedman/gcsv"
)

Expect("a,b,c,1,2,3").To(RepresentSchema([]interface{"a","b","c",1,2,3})) // Pass
Expect("a,b,c,d,e,f").To(RepresentSchema([]interface{"a","b","c",1,2,3})) // Fail!

Expect("header1,header2,header3,header4,header5,header6\na,b,c,d,e,f").
  To(RepresentSchema([]interface{"a","b","c",1,2,3}, IgnoreHeaderRow())) // Pass

Expect("header1,header2,header3,header4,header5,header6\na,b,c,d,e,f").
  To(RepresentSchema([]interface{"a","b","c",1,2,3}, WithHeaders("jeepers", "creepers"))) // Fail!

About

Gomega Matchers for CSV Schema

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages