Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

测试 testing 程序,对 LANGUAGE 环境变量处理异常 #14

Open
atzlinux opened this issue Dec 6, 2021 · 2 comments
Open

测试 testing 程序,对 LANGUAGE 环境变量处理异常 #14

atzlinux opened this issue Dec 6, 2021 · 2 comments

Comments

@atzlinux
Copy link

atzlinux commented Dec 6, 2021

操作系统 Debian 11

1.当 LANGUAGE 环境变量 为 空时,测试程序正常。

unset LANGUAGE;./testing
# random seed: R02S3fb5d545fb09cfd26e43c5f2b20c6fae
1..4
# Start of date tests
ok 1 /date/solar
ok 2 /date/lunar
ok 3 /date/holiday
# Start of holiday tests
ok 4 /date/holiday/custom
# End of holiday tests
# End of date tests

2.当 LANGUAGE 环境变量 为中文 zh_CN 时,测试程序正常。

export LANGUAGE=zh_CN;./testing
# random seed: R02S0dca562337f54666052de5c407744956
1..4
# Start of date tests
ok 1 /date/solar
ok 2 /date/lunar
ok 3 /date/holiday
# Start of holiday tests
ok 4 /date/holiday/custom
# End of holiday tests
# End of date tests

3.当 LANGUAGE 环境变量 既不为空,也不为 中文 zh_CN 时,测试程序异常报错。
比如说,设置 LANGUAGE 为标准的 C:

export LANGUAGE=C;./testing
# random seed: R02Se0c59ed76a34c8ae88ab6b1c1bc798f0
1..4
# Start of date tests
ok 1 /date/solar
**
ERROR:../tests/testing.c:226:test_lunar_date: assertion failed (lunar_array[i].raw_value == value): ("\345\233\275\345\272\206\350\212\202" == "")
Bail out! ERROR:../tests/testing.c:226:test_lunar_date: assertion failed (lunar_array[i].raw_value == value): ("\345\233\275\345\272\206\350\212\202" == "")
Aborted

设置 LANGUAGE 为 en_US:en

export LANGUAGE=en_US:en;./testing
# random seed: R02Se4c359ee85686df4bbe1c12fac15069f
1..4
# Start of date tests
ok 1 /date/solar
**
ERROR:../tests/testing.c:226:test_lunar_date: assertion failed (lunar_array[i].raw_value == value): ("\345\233\275\345\272\206\350\212\202" == "")
Bail out! ERROR:../tests/testing.c:226:test_lunar_date: assertion failed (lunar_array[i].raw_value == value): ("\345\233\275\345\272\206\350\212\202" == "")
Aborted

在 Debian 的 CI/CD 上,也有这个报错:
https://salsa.debian.org/chinese-team/lunar-date/-/jobs/2218863

@atzlinux
Copy link
Author

atzlinux commented Dec 19, 2021

devel branch 9ff7dfa 修复了这个报错。

但是在以上语言环境的测试中,输出少了如下两项测试:

ok 3 /date/holiday
# Start of holiday tests
ok 4 /date/holiday/custom
# End of holiday tests

有办法在非中文的 LANGUAGE 下,完成这两个测试吗?
希望能够在不同语言环境变量下,测试项、测试内容保持一致,这样也有利于该项目的国际化。

@yetist
Copy link
Owner

yetist commented Jan 2, 2022

这 2 个测试依赖于 mo 文件内容,在非中文环境下没有对应的 mo。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants