Skip to content

Commit 3bc1011

Browse files
authored
Merge pull request mull-project#163 from mull-project/develop
Force stdout to always encode UTF8
2 parents 286d725 + 38add13 commit 3bc1011

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

filecheck/FileCheck.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ def implicit_check_line(check_not_check, strict_mode, line):
200200

201201

202202
def main():
203+
# Force UTF-8 to be sent to stdout.
204+
# https://stackoverflow.com/a/3597849/598057
205+
sys.stdout = open(1, 'w', encoding='utf-8', closefd=False)
206+
203207
args = None
204208
input_lines = None
205209

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHECK: Match line that does not exist in input.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# © A line with UTF-8 produces
2+
# vadsэавфыаЭХÜÜÄ
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
RUN: %cat "%S/sample.input" | \
2+
RUN: %expect_exit 1 %FILECHECK_EXEC "%S/sample.check" --dump-input=fail | \
3+
RUN: %FILECHECK_TESTER_EXEC "%s" \
4+
RUN: --strict-whitespace \
5+
RUN: --match-full-lines
6+
7+
CHECK:{{.*}}/sample.check:1:8: error: CHECK: expected string not found in input
8+
CHECK:{{.*}}CHECK: Match line that does not exist in input.
9+
CHECK:{{.*}}<stdin>:1:1: note: scanning from here
10+
CHECK:{{.*}}# © A line with UTF-8 produces
11+
CHECK:{{.*}}# vadsэавфыаЭХÜÜÄ

tests/integration/tools/expect_exit.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import subprocess
22
import sys
33

4+
# Force UTF-8 to be sent to stdout.
5+
# https://stackoverflow.com/a/3597849/598057
6+
sys.stdout = open(1, 'w', encoding='utf-8', closefd=False)
7+
48
if len(sys.argv) <= 2:
59
print("error: expect_exit: expect arguments to be provided")
610
exit(1)

0 commit comments

Comments
 (0)