Skip to content

Commit

Permalink
Explicitly specify query return types in test-online to avoid compila…
Browse files Browse the repository at this point in the history
…tion errors.
  • Loading branch information
levlam committed May 13, 2024
1 parent b5610e5 commit dbd22cb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions test/online.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ class InitTask : public Task {

void start_up() override {
send_query(td::make_tl_object<td::td_api::getOption>("version"),
[](auto res) { LOG(INFO) << td::td_api::to_string(res.ok()); });
[](td::Result<td::td_api::object_ptr<td::td_api::OptionValue>> res) {
LOG(INFO) << td::td_api::to_string(res.ok());
});
}
void process_authorization_state(td::tl_object_ptr<td::td_api::Object> authorization_state) {
td::tl_object_ptr<td::td_api::Function> function;
Expand Down Expand Up @@ -283,7 +285,9 @@ class GetMe : public Task {
explicit GetMe(Promise<Result> promise) : promise_(std::move(promise)) {
}
void start_up() override {
send_query(td::make_tl_object<td::td_api::getMe>(), [this](auto res) { with_user_id(res.move_as_ok()->id_); });
send_query(
td::make_tl_object<td::td_api::getMe>(),
[this](td::Result<td::td_api::object_ptr<td::td_api::user>> res) { with_user_id(res.move_as_ok()->id_); });
}

private:
Expand All @@ -292,8 +296,9 @@ class GetMe : public Task {

void with_user_id(int64 user_id) {
result_.user_id = user_id;
send_query(td::make_tl_object<td::td_api::createPrivateChat>(user_id, false),
[this](auto res) { with_chat_id(res.move_as_ok()->id_); });
send_query(
td::make_tl_object<td::td_api::createPrivateChat>(user_id, false),
[this](td::Result<td::td_api::object_ptr<td::td_api::chat>> res) { with_chat_id(res.move_as_ok()->id_); });
}

void with_chat_id(int64 chat_id) {
Expand Down Expand Up @@ -336,7 +341,7 @@ class UploadFile : public Task {
td::make_tl_object<td::td_api::inputMessageDocument>(
td::make_tl_object<td::td_api::inputFileLocal>(content_path_), nullptr, true,
td::make_tl_object<td::td_api::formattedText>("tag", td::Auto()))),
[this](auto res) { with_message(res.move_as_ok()); });
[this](td::Result<td::td_api::object_ptr<td::td_api::message>> res) { with_message(res.move_as_ok()); });
}

private:
Expand Down Expand Up @@ -392,7 +397,7 @@ class TestDownloadFile : public Task {
}
void start_up() override {
send_query(td::make_tl_object<td::td_api::getRemoteFile>(remote_id_, nullptr),
[this](auto res) { start_file(*res.ok()); });
[this](td::Result<td::td_api::object_ptr<td::td_api::file>> res) { start_file(*res.ok()); });
}

private:
Expand Down Expand Up @@ -454,7 +459,7 @@ class TestDownloadFile : public Task {
send_query(td::make_tl_object<td::td_api::downloadFile>(
file_id_, 1, static_cast<int64>(ranges_.back().begin),
static_cast<int64>(ranges_.back().end - ranges_.back().begin), true),
[this](auto res) { on_get_chunk(*res.ok()); });
[this](td::Result<td::td_api::object_ptr<td::td_api::file>> res) { on_get_chunk(*res.ok()); });
}
};

Expand Down

0 comments on commit dbd22cb

Please sign in to comment.