Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5977: Add unit test checking that reloadDecls re-parses the file
- Loading branch information
1 parent
38ed7f2
commit df14b27
Showing
8 changed files
with
134 additions
and
12 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <fstream> | ||
#include "os/file.h" | ||
|
||
namespace test | ||
{ | ||
|
||
// File object removing itself when going out of scope | ||
class TemporaryFile | ||
{ | ||
private: | ||
std::string _path; | ||
|
||
public: | ||
TemporaryFile(const std::string& path, const std::string& contents = "") : | ||
_path(path) | ||
{ | ||
setContents(contents); | ||
} | ||
|
||
void setContents(const std::string& contents) | ||
{ | ||
std::ofstream stream(_path, std::ofstream::out); | ||
stream << contents; | ||
stream.flush(); | ||
stream.close(); | ||
} | ||
|
||
~TemporaryFile() | ||
{ | ||
fs::remove(_path); | ||
} | ||
}; | ||
|
||
} |
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