From b3d45c71041478c1410bfae2aaf88a95106cfc5b Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Mon, 21 Oct 2024 07:33:33 +0200 Subject: [PATCH] ArcanistBundleTestCase: fix support of non-English environments Summary: Recently this unit test was always failing for some specific users. I was able to reproduce the issue with an Italian unix environment: arc unit src/parser/__tests__/ArcanistBundleTestCase.php Obtaining: counterexample EXCEPTION (Exception): Diff Parse Exception: Expected '\ No newline at end of file'. After this change, the involved unit test always work also in my Italian environment. Note that the `LC_ALL=C` means that all localization should be deactivated, and we should instead use C-sourced strings (not translated in any language). Nice! Closes T15927 Test Plan: Run the unit test. It does not fail anymore if you are Italian of French or whatever. Reviewers: O1 Blessed Committers, mainframe98, 20after4 Reviewed By: O1 Blessed Committers, mainframe98, 20after4 Subscribers: mainframe98, aklapper, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15927 Differential Revision: https://we.phorge.it/D25809 --- src/parser/__tests__/ArcanistBundleTestCase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parser/__tests__/ArcanistBundleTestCase.php b/src/parser/__tests__/ArcanistBundleTestCase.php index 0b183324..3ea2b72a 100644 --- a/src/parser/__tests__/ArcanistBundleTestCase.php +++ b/src/parser/__tests__/ArcanistBundleTestCase.php @@ -11,8 +11,10 @@ final class ArcanistBundleTestCase extends PhutilTestCase { } private function loadDiff($old, $new) { + // This unit test must parse 'diff' output in a language independent way, + // so we need LC_ALL=C. list($err, $stdout) = exec_manual( - 'diff --unified=65535 --label %s --label %s -- %s %s', + 'LC_ALL=C diff --unified=65535 --label %s --label %s -- %s %s', 'file 9999-99-99', 'file 9999-99-99', $this->getResourcePath($old),