Git Product home page Git Product logo

rose's Introduction

Tests codecov Go Report Card GoDoc

Rose

Rose is a golden file utility library for your Go tests.

It handles the dirty work so your tests stay concise and readable.

  • Normalizes common file formats
  • Helps organize files with per-test path prefixes
  • Leaves you in control of supplying the update flag

Usage

package mypackage

import (
	"flag"
	"testing"

	"github.com/eberkund/rose/gold"
)

// Use `go test ./... -update` to write new files with supplied data
var update = flag.Bool("update", false, "update golden files")

func TestFiles(t *testing.T) {
    g := gold.New(
        t,

        // Pass the update flag to Gold constructor
        gold.WithFlag(*update),

        // Store files in `testdata/<test name>/<file name>`
        // Prefix defaults to `testdata`
        gold.WithPrefix("testdata", t.Name()),
    )

    // Provide the filename and input data
    g.AssertEqualsJSON("somefile.golden.json", `{"foo": 123}`)
}

rose's People

Contributors

eberkund avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

oscarhanzely

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.