Skip to content

Add virtual keyword to Module methods to make it Mock-able #10521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions extension/module/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Module {
Module& operator=(const Module&) = delete;
Module(Module&&) = delete;
Module& operator=(Module&&) = delete;

virtual ~Module() = default;
/**
* Loads the program if needed.
*
Expand All @@ -119,8 +119,7 @@ class Module {
*
* @returns An Error to indicate success or failure of the loading process.
*/
ET_NODISCARD
runtime::Error load(
ET_NODISCARD virtual runtime::Error load(
const Program::Verification verification =
Program::Verification::Minimal);

Expand All @@ -129,7 +128,7 @@ class Module {
*
* @returns true if the program is loaded, false otherwise.
*/
inline bool is_loaded() const {
virtual inline bool is_loaded() const {
return program_ != nullptr;
}

Expand Down Expand Up @@ -242,8 +241,7 @@ class Module {
* @returns A Result object containing either a vector of output values
* from the method or an error to indicate failure.
*/
ET_NODISCARD
runtime::Result<std::vector<runtime::EValue>> execute(
ET_NODISCARD virtual runtime::Result<std::vector<runtime::EValue>> execute(
const std::string& method_name,
const std::vector<runtime::EValue>& input_values);

Expand Down
Loading