Async File.writeFile.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3673 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-10-27 23:27:21 +00:00
parent 08e32c0de4
commit 07a0828626
3 changed files with 102 additions and 31 deletions

View File

@ -506,6 +506,20 @@ static void _test_file(const tf_test_options_t* options)
" exit(1);\n"
"}).catch(function(error) {\n"
" print('expected error', error);\n"
"});\n"
"File.writeFile('out/new.txt', 'hello').then(function(result) {\n"
" File.readFile('out/new.txt').then(function(data) {\n"
" print('READ', utf8Decode(data));\n"
" if (utf8Decode(data) != 'hello') {\n"
" exit(1);\n"
" }\n"
" }).catch(function(error) {\n"
" print('unexpected read error', error);\n"
" exit(1);\n"
" });\n"
"}).catch(function(error) {\n"
" print('unexpected write error', error);\n"
" exit(1);\n"
"});\n");
fclose(file);