|
|
@@ -88,3 +88,31 @@ std::string test_ctx_Controller_registerFieldCallback_match() { |
|
|
|
} |
|
|
|
return "ERR: ctx_Controller_registerFieldCallback_match"; |
|
|
|
} |
|
|
|
|
|
|
|
std::string test_ctx_Controller_registerFieldCallback_mismatch() { |
|
|
|
auto c = memory_createContext(); |
|
|
|
ctx_Controller<memory_Context> ctrl(c); |
|
|
|
|
|
|
|
c.input = "123"; |
|
|
|
c.outputHelp = "you"; |
|
|
|
// A field other than 'input' is marked recent. |
|
|
|
c.recentField = "outputHelp"; |
|
|
|
std::string callbackInput = ""; |
|
|
|
|
|
|
|
auto setCallbackInput = [&callbackInput](memory_Context c) { |
|
|
|
if ( |
|
|
|
c.recentField == "input" |
|
|
|
) { |
|
|
|
callbackInput = c.input; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
ctrl.registerFieldCallback("input", setCallbackInput); |
|
|
|
ctrl.reportContext(); |
|
|
|
if ( |
|
|
|
callbackInput == "" |
|
|
|
) { |
|
|
|
return "OK: ctx_Controller_registerFieldCallback_mismatch"; |
|
|
|
} |
|
|
|
return "ERR: ctx_Controller_registerFieldCallback_mismatch"; |
|
|
|
} |