mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Add test for FS::open("w+") (#7241)
Verify that a file is truncated on opening with w+ even if no data is written to it, for all FSes. Co-authored-by: Develo <deveyes@gmail.com>
This commit is contained in:
parent
368ca91869
commit
2de9242b1a
@ -161,6 +161,19 @@ TEST_CASE(TESTPRE "truncate", TESTPAT)
|
||||
REQUIRE( s == "some" );
|
||||
}
|
||||
|
||||
TEST_CASE(TESTPRE "open(w+) truncates file", TESTPAT)
|
||||
{
|
||||
FS_MOCK_DECLARE(64, 8, 512, "");
|
||||
REQUIRE(FSTYPE.begin());
|
||||
createFile("/file1", "some text");
|
||||
String s = readFile("/file1");
|
||||
REQUIRE( s == "some text");
|
||||
auto f = FSTYPE.open("/file1", "w+");
|
||||
f.close();
|
||||
String t = readFile("/file1");
|
||||
REQUIRE( t == "");
|
||||
}
|
||||
|
||||
#ifdef FS_HAS_DIRS
|
||||
|
||||
#if FSTYPE != SDFS
|
||||
|
Loading…
x
Reference in New Issue
Block a user