-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert
fstream.seekp(0, ios::cur)
change (#3841)
- Loading branch information
1 parent
40640c6
commit 2261f7e
Showing
5 changed files
with
55 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...sts/GH_003572_fstream_seekp_0_cur/env.lst → ...when_reading_lf_file_in_text_mode/env.lst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
RUNALL_INCLUDE ..\usual_matrix.lst | ||
RUNALL_INCLUDE ..\usual_17_matrix.lst |
51 changes: 51 additions & 0 deletions
51
tests/std/tests/GH_003840_tellg_when_reading_lf_file_in_text_mode/test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <cassert> | ||
#include <filesystem> | ||
#include <fstream> | ||
#include <ios> | ||
#include <string> | ||
|
||
#include "temp_file_name.hpp" | ||
|
||
using namespace std; | ||
|
||
void test(const string& temp_file_name_str, const ios_base::openmode mode) { | ||
filesystem::remove(temp_file_name_str); | ||
|
||
{ | ||
ofstream out{temp_file_name_str, mode}; | ||
out << "Line A\n"; | ||
out << "Line B\n"; | ||
out << "Line C\n"; | ||
} | ||
|
||
{ | ||
ifstream in{temp_file_name_str}; | ||
string line; | ||
|
||
assert(getline(in, line)); | ||
assert(line == "Line A"); | ||
(void) in.tellg(); | ||
|
||
assert(getline(in, line)); | ||
assert(line == "Line B"); | ||
(void) in.tellg(); | ||
|
||
assert(getline(in, line)); | ||
assert(line == "Line C"); | ||
(void) in.tellg(); | ||
|
||
assert(!getline(in, line)); | ||
} | ||
|
||
filesystem::remove(temp_file_name_str); | ||
} | ||
|
||
int main() { | ||
const string temp_file_name_str = temp_file_name(); | ||
|
||
test(temp_file_name_str, ios_base::out); | ||
test(temp_file_name_str, ios_base::binary); | ||
} |