Skip to content

lesiw/fill

Repository files navigation

lesiw.io/fill

Go Reference

A utility for filling Go values.

Example

package main

import (
    "crypto/tls"
    "testing"

    "github.com/google/go-cmp/cmp"
    "github.com/google/go-cmp/cmp/cmpopts"
    "lesiw.io/fill"
)

func TestTlsConfigClone(t *testing.T) {
    opts := cmp.Options{cmpopts.IgnoreUnexported(tls.Config{})}
    for range 100 {
        cfg := new(tls.Config)
        fill.Rand(cfg)
        if want, got := cfg, cfg.Clone(); !cmp.Equal(want, got, opts) {
            t.Fatalf("-original +cloned\n%s", cmp.Diff(want, got, opts))
        }
    }
}

▶️ Run this example on the Go Playground

About

Package fill fills Go values with random data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages