...

Source file src/github.com/chai2010/gettext-go/fs_test.go

Documentation: github.com/chai2010/gettext-go

     1  // Copyright 2020 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 gettext
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestFileSystem_os(t *testing.T) {
    12  	fs := OS("./examples/locale")
    13  	tAssert(t, fs.String() == "gettext.localfs(./examples/locale)", fs.String())
    14  
    15  	testExamplesLocal(t, fs)
    16  }
    17  
    18  func TestFileSystem_zip(t *testing.T) {
    19  	fs := NewFS("./examples/locale.zip", nil)
    20  	tAssert(t, fs.String() == "gettext.zipfs(./examples/locale.zip)", fs.String())
    21  
    22  	testExamplesLocal(t, fs)
    23  }
    24  
    25  func testExamplesLocal(t *testing.T, fs FileSystem) {
    26  	localeList := fs.LocaleList()
    27  	tAssert(t, len(localeList) == 3, localeList)
    28  	tAssert(t, localeList[0] == "default")
    29  	tAssert(t, localeList[1] == "zh_CN")
    30  	tAssert(t, localeList[2] == "zh_TW")
    31  }
    32  

View as plain text