github.com/nilium/gitlab-runner@v12.5.0+incompatible/helpers/toml_test.go (about)

     1  package helpers
     2  
     3  import (
     4  	"github.com/BurntSushi/toml"
     5  	"github.com/stretchr/testify/assert"
     6  	"github.com/stretchr/testify/require"
     7  	"testing"
     8  )
     9  
    10  func TestTOMLOmitEmpty(t *testing.T) {
    11  	var config struct {
    12  		Value int `toml:"value,omitzero"`
    13  	}
    14  
    15  	// This test is intended to test this not fixed problem:
    16  	// https://github.com/chowey/toml/commit/8249b7bc958927e7a8b392f66adbe4d5ead737d9
    17  	text := `Value=10`
    18  	_, err := toml.Decode(text, &config)
    19  	require.NoError(t, err)
    20  	assert.Equal(t, 10, config.Value)
    21  }