def test_fgets_eol(self):
    src = '\n      #include <stdio.h>\n      char buf[32];\n      int main()\n      {\n        const char *r = "SUCCESS";\n        FILE *f = fopen("eol.txt", "r");\n        while (fgets(buf, 32, f) != NULL) {\n          if (buf[0] == \'\\0\') {\n            r = "FAIL";\n            break;\n          }\n        }\n        printf("%s\\n", r);\n        fclose(f);\n        return 0;\n      }\n    '
    open('eol.txt', 'wb').write(b'\n')
    self.emcc_args += ['--embed-file', 'eol.txt']
    self.do_run(src, 'SUCCESS\n')
def test_fgets_eol(self):
    src = '\n      #include <stdio.h>\n      char buf[32];\n      int main()\n      {\n        const char *r = "SUCCESS";\n        FILE *f = fopen("eol.txt", "r");\n        while (fgets(buf, 32, f) != NULL) {\n          if (buf[0] == \'\\0\') {\n            r = "FAIL";\n            break;\n          }\n        }\n        printf("%s\\n", r);\n        fclose(f);\n        return 0;\n      }\n    '
    open('eol.txt', 'wb').write(b'\n')
    self.emcc_args += ['--embed-file', 'eol.txt']
    self.do_run(src, 'SUCCESS\n')