package messages

import (
	"gnd.la/log"
	"os"
	"testing"
)

func TestExtract(t *testing.T) {
	log.SetLevel(log.LDebug)
	m, err := Extract("_test_data", DefaultFunctions(), DefaultTypes(), DefaultTagFields())
	if err != nil {
		t.Error(err)
	}
	t.Logf("Messages %v", m)
	Write(os.Stdout, m)
}

package messages

import (
	"bytes"
	"gnd.la/log"
	"io/ioutil"
	"path/filepath"
	"testing"
)

func TestExtract(t *testing.T) {
	log.SetLevel(log.LDebug)
	m, err := Extract("_test_data", DefaultFunctions(), DefaultTypes(), DefaultTagFields())
	if err != nil {
		t.Error(err)
	}
	var buf bytes.Buffer
	if err := Write(&buf, m); err != nil {
		t.Error(err)
	}
	t.Logf("Messages:\n%s", string(buf.Bytes()))
	b, err := ioutil.ReadFile(filepath.Join("_test_data", "test.pot"))
	if err != nil {
		t.Error(err)
	}
	if len(b) != len(buf.Bytes()) || bytes.Compare(b, buf.Bytes()) != 0 {
		t.Errorf("invalid messages (%d / %d)", len(b), len(buf.Bytes()))
	}
}

Update test for message extraction
Update test for message extraction
