Skip to content

Add some kind of setup/cleanup for temporary files for testing, to be called at the start/end of a test function #7

@Ttibsi

Description

@Ttibsi

Spitballing - we don't just want a mk_temp_file() and cleanup_temp_file() function if we can help it.. some kind of struct that handles this in the constructor/destructor to use RAII for cleanup. Something like this (untested)

struct TempFile {
    explicit TempFile(std::string fileName, std::string contents) {
        // make the file here        
        // Contents could be empty as well (second ctor?)
    }

    // cleanup
    ~TempFile() {}

    // Other methods
    bool compare_file(); // does the temp file match expected content
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions