...

Source file src/github.com/chai2010/gettext-go/po/poedit_test.go

Documentation: github.com/chai2010/gettext-go/po

     1  // Copyright 2013 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package po
     6  
     7  import (
     8  	"reflect"
     9  	"testing"
    10  )
    11  
    12  var (
    13  	testPoEditPoFile = "../testdata/poedit-1.5.7-zh_CN.po"
    14  	testPoEditMoFile = "../testdata/poedit-1.5.7-zh_CN.mo"
    15  )
    16  
    17  func _TestPoEditPoFile(t *testing.T) {
    18  	po, err := LoadFile(testPoEditPoFile)
    19  	if err != nil {
    20  		t.Fatal(err)
    21  	}
    22  	if !reflect.DeepEqual(&po.MimeHeader, &poEditFile.MimeHeader) {
    23  		t.Fatalf("expect = %v, got = %v", &poEditFile.MimeHeader, &po.MimeHeader)
    24  	}
    25  	if len(po.Messages) != len(poEditFile.Messages) {
    26  		t.Fatal("size not equal")
    27  	}
    28  	for k, v0 := range po.Messages {
    29  		if v1 := poEditFile.Messages[k]; !reflect.DeepEqual(&v0, &v1) {
    30  			t.Fatalf("%d: expect = %v, got = %v", k, v1, v0)
    31  		}
    32  	}
    33  }
    34  
    35  var poEditFile = &File{}
    36  

View as plain text