aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-24 13:59:46 +0200
committerAlon Zakai <alonzakai@gmail.com>2012-05-24 13:59:46 +0200
commit9662b116ce446adc36d70453976989a16b8f2997 (patch)
tree4c9bddff98fb1da5e653271fbcb28228b5178330 /tests
parent7b9855c0625fbc8469b70dd5e3ee3d6772977766 (diff)
make fgetc return the char value as unsigned (in a signed int)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index ed9bcdd5..e9c9018b 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3954,6 +3954,20 @@ def process(filename):
'''
self.do_run(src, 'isatty? 0,0,1\ngot: 35\ngot: 45\ngot: 25\ngot: 15\n', post_build=post)
+ def test_fgetc_unsigned(self):
+ if self.emcc_args is None: return self.skip('requires emcc')
+ src = r'''
+ #include <stdio.h>
+ int main() {
+ FILE *file = fopen("file_with_byte_234.txt", "rb");
+ int c = fgetc(file);
+ printf("*%d\n", c);
+ }
+ '''
+ open('file_with_byte_234.txt', 'wb').write('\xea')
+ self.emcc_args += ['--embed-file', 'file_with_byte_234.txt']
+ self.do_run(src, '*234\n')
+
def test_folders(self):
add_pre_run = '''
def process(filename):