diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-24 14:37:33 +0100 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-24 14:37:33 +0100 |
commit | 9c5a0dbdd3a7a1052a58735c654c3cb69dadf140 (patch) | |
tree | fd1c759fd89d9a0b68abc39025dc3fca7e5cb882 /tests | |
parent | 16eda852f5eb7efcccab571fba6090687ba34dee (diff) |
fix snprintf on output size 0
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index f3289e46..deeb5689 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -4318,6 +4318,19 @@ at function.:blag ''' self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected)) + def test_snprintf0(self): + src = r''' + #include <stdio.h> + int main() { + int size = snprintf(NULL, 0, "%s %d %.2f\n", "me and myself", 25, 1.345); + char buf[size]; + snprintf(buf, size, "%s %d %.2f\n", "me and myself", 25, 1.345); + printf("%d : %s\n", size, buf); + return 0; + } + ''' + self.do_run(src, '22 : me and myself 25 1.34\n') + def test_atoX(self): if self.emcc_args is None: return self.skip('requires ta2') |