util

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package util contains helper for test

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvAsMap

func EnvAsMap() map[string]string

EnvAsMap returns environment variables as string map TODO: might cache it when package init, the problem of doing so is user might call os.Setenv, we also do this in test

func GeneratedHeader

func GeneratedHeader(generator string, template string) string

func LoadDotEnv

func LoadDotEnv(t *testing.T)

LoadDotEnv load .env in current directory into environment variable, line start with # are comments It is modeled after https://github.com/motdotla/dotenv

func MapKeys

func MapKeys(m map[string]interface{}) []string

MapKeys returns keys of a map as string slice in an undermined order NOTE: you can not pass map[string]string because string is not interface{}, you need to convert it, but you can get the keys along the way of converting ...

func MapSortedKeys

func MapSortedKeys(m map[string]interface{}, asc bool) []string

MapKeys returns keys of a map as string slice in an asc/desc order as specified

func MergeStringMap

func MergeStringMap(dst map[string]interface{}, extra map[string]interface{})

MergeStringMap merges the second map to first map, and keep the value of the second map if there is duplicate key

func ReadFixture

func ReadFixture(t *testing.T, path string) []byte

func ReadJson

func ReadJson(t *testing.T, path string, v interface{})

Types

This section is empty.

Directories

Path Synopsis
Package hashutil provides alloc free alternatives for pkg/hash
Package hashutil provides alloc free alternatives for pkg/hash

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL