File: toml_test.go

package info (click to toggle)
gitlab-ci-multi-runner 14.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,248 kB
  • sloc: sh: 1,694; makefile: 384; asm: 79; ruby: 68
file content (25 lines) | stat: -rw-r--r-- 557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//go:build !integration
// +build !integration

package helpers

import (
	"testing"

	"github.com/BurntSushi/toml"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestTOMLOmitEmpty(t *testing.T) {
	var config struct {
		Value int `toml:"value,omitzero"`
	}

	// This test is intended to test this not fixed problem:
	// https://github.com/chowey/toml/commit/8249b7bc958927e7a8b392f66adbe4d5ead737d9
	text := `Value=10`
	_, err := toml.Decode(text, &config)
	require.NoError(t, err)
	assert.Equal(t, 10, config.Value)
}