Change las_dictionary_tests for os-specific paths

This commit is contained in:
dcslagel 2020-05-19 10:58:49 -06:00
Родитель 547df2ae77
Коммит c8feb1e2cd
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -4,6 +4,7 @@
package glasio
import (
"path/filepath"
"testing"
)
@ -12,19 +13,19 @@ func TestLoadStdMnemonicDic(t *testing.T) {
if err == nil {
t.Errorf("<LoadStdMnemonicDic> on test 1 return error == nil\n")
}
_, err = LoadStdMnemonicDic("data\\mnemonic.ini") //file ini exist, return error == nil
_, err = LoadStdMnemonicDic(filepath.Join("data", "mnemonic.ini")) //file ini exist, return error == nil
if err != nil {
t.Errorf("<LoadStdMnemonicDic> on test 2 expect error = nil, return error: %s\n", err)
}
_, err = LoadStdMnemonicDic("data\\mn.ini") //file ini not exist, return error
_, err = LoadStdMnemonicDic(filepath.Join("data", "mn.ini")) //file ini not exist, return error
if err == nil {
t.Errorf("<LoadStdMnemonicDic> on test 3 expect error != nil, return nil\n")
}
_, err = LoadStdMnemonicDic("data\\dic.ini") //file ini exist, section not exist, return error != nil
_, err = LoadStdMnemonicDic(filepath.Join("data", "dic.ini")) //file ini exist, section not exist, return error != nil
if err == nil {
t.Errorf("<LoadStdMnemonicDic> on test 4 expect error = nil, return error: %s\n", err)
}
_, err = LoadStdMnemonicDic("data\\dic0.ini") //file ini exist, file empty, return error != nil
_, err = LoadStdMnemonicDic(filepath.Join("data", "dic0.ini")) //file ini exist, file empty, return error != nil
if err == nil {
t.Errorf("<LoadStdMnemonicDic> on test 5 expect error = nil, return error: %s\n", err)
}
@ -35,19 +36,19 @@ func TestLoadStdVocabularyDictionary(t *testing.T) {
if err == nil {
t.Errorf("<LoadStdVocabularyDictionary> on test 1 return error == nil\n")
}
_, err = LoadStdVocabularyDictionary("data\\dic.ini") //file ini exist, return error == nil
_, err = LoadStdVocabularyDictionary(filepath.Join("data", "dic.ini")) //file ini exist, return error == nil
if err != nil {
t.Errorf("<LoadStdVocabularyDictionary> on test 2 expect error = nil, return error: %s\n", err)
}
_, err = LoadStdVocabularyDictionary("data\\mn.ini") //file ini not exist, return error
_, err = LoadStdVocabularyDictionary(filepath.Join("data", "mn.ini")) //file ini not exist, return error
if err == nil {
t.Errorf("<LoadStdVocabularyDictionary> on test 3 expect error != nil, return nil\n")
}
_, err = LoadStdVocabularyDictionary("data\\mnemonic.ini") //file ini exist, section not exist, return error != nil
_, err = LoadStdVocabularyDictionary(filepath.Join("data", "mnemonic.ini")) //file ini exist, section not exist, return error != nil
if err == nil {
t.Errorf("<LoadStdVocabularyDictionary> on test 4 expect error = nil, return error: %s\n", err)
}
_, err = LoadStdVocabularyDictionary("data\\mnemonic0.ini") //file ini exist, file empty, return error != nil
_, err = LoadStdVocabularyDictionary(filepath.Join("data", "mnemonic0.ini")) //file ini exist, file empty, return error != nil
if err == nil {
t.Errorf("<LoadStdVocabularyDictionary> on test 5 expect error = nil, return error: %s\n", err)
}