...

Source file src/github.com/chai2010/gettext-go/po/message_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  func _TestPoEntry(t *testing.T) {
    13  	if len(testPoEntrys) != len(testPoEntryStrings) {
    14  		t.Fatalf("bad test")
    15  	}
    16  	var entry Message
    17  	for i := 0; i < len(testPoEntrys); i++ {
    18  		if err := entry.readPoEntry(newLineReader(testPoEntryStrings[i])); err != nil {
    19  			t.Fatal(err)
    20  		}
    21  		if !reflect.DeepEqual(&entry, &testPoEntrys[i]) {
    22  			t.Fatalf("%d: expect = %v, got = %v", i, testPoEntrys[i], entry)
    23  		}
    24  	}
    25  }
    26  
    27  var testPoEntryStrings = []string{
    28  	`
    29  # SOME DESCRIPTIVE TITLE.
    30  # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
    31  # This file is distributed under the same license as the PACKAGE package.
    32  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
    33  #
    34  msgid ""
    35  msgstr ""
    36  "Project-Id-Version: 项目名称\n"
    37  "Report-Msgid-Bugs-To: \n"
    38  "POT-Creation-Date: 2011-12-12 20:03+0000\n"
    39  "PO-Revision-Date: 2013-12-02 17:05+0800\n"
    40  "Last-Translator: chai2010 <chaishushan@gmail.com>\n"
    41  "Language-Team: chai2010(团队) <chaishushan@gmail.com>\n"
    42  "Language: 中文\n"
    43  "MIME-Version: 1.0\n"
    44  "Content-Type: text/plain; charset=UTF-8\n"
    45  "Content-Transfer-Encoding: 8bit\n"
    46  "X-Generator: Poedit 1.5.7\n"
    47  "X-Poedit-SourceCharset: UTF-8\n"
    48  `,
    49  }
    50  
    51  var testPoEntrys = []Message{
    52  	Message{
    53  		Comment: Comment{
    54  			TranslatorComment: `SOME DESCRIPTIVE TITLE.
    55  Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
    56  This file is distributed under the same license as the PACKAGE package.
    57  FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
    58  `,
    59  		},
    60  		MsgStr: `
    61  Project-Id-Version: 项目名称
    62  Report-Msgid-Bugs-To: 
    63  POT-Creation-Date: 2011-12-12 20:03+0000
    64  PO-Revision-Date: 2013-12-02 17:05+0800
    65  Last-Translator: chai2010 <chaishushan@gmail.com>
    66  Language-Team: chai2010(团队) <chaishushan@gmail.com>
    67  Language: 中文
    68  MIME-Version: 1.0
    69  Content-Type: text/plain; charset=UTF-8
    70  Content-Transfer-Encoding: 8bit
    71  X-Generator: Poedit 1.5.7
    72  X-Poedit-SourceCharset: UTF-8
    73  `,
    74  	},
    75  }
    76  

View as plain text