~nvkv/amitm

ref: decc8d65f3474f58f30c63bd0ee9924da635ef78 amitm/internal/config/v1/config_test.go -rw-r--r-- 377 bytes
decc8d65Semyon Novikov Untangle config reading from reading file 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package config

import (
	"fmt"
	"testing"
)

func TestReadConfig(t *testing.T) {
	fixture := []byte(`
[[rules]]
name = "Testing tests"
glob = "test*.test"
action = "put"

[[rules.pipeline]]
exec = "test -t $file"`)

	cfg, err := NewConfig(fixture)
	fmt.Printf("cfg: %+v\n", cfg.actionmap)
	if err != nil || cfg == nil {
		t.Errorf("Can't read %s file: %s", fixture, err)
	}
}