Fix doc tests

This commit is contained in:
Sebastian Thiel
2021-04-01 18:29:40 +08:00
parent e363097e43
commit c4d4013358
3 changed files with 5 additions and 4 deletions

View File

@@ -256,7 +256,7 @@ use ${util.library_name()}::${hub_type};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
% endif
let secret: ApplicationSecret = Default::default();
let secret: oauth2::ApplicationSecret = Default::default();
% if comments:
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
@@ -268,7 +268,7 @@ let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
secret,
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = ${hub_type}::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth);\
let mut hub = ${hub_type}::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);\
</%def>
## You will still have to set the filter for your comment type - either nothing, or rust_doc_comment !

View File

@@ -371,7 +371,7 @@ let result = hub.${mangle_ident(resource)}().${mangle_ident(method)}(${required_
</%block>\
% endfor
${'.' + action_name | indent_by(13)}(${action_args});
${'.' + action_name | indent_by(13)}(${action_args}).await;
% if handle_result:
match result {
@@ -379,6 +379,7 @@ match result {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled

View File

@@ -234,7 +234,7 @@ def markdown_rust_block(s):
# wraps s into an invisible doc test function.
def rust_test_fn_invisible(s):
return "# #[test] fn egal() {\n%s# }" % trailing_newline(s)
return "# async fn dox() {\n%s# }" % trailing_newline(s)
# markdown comments
def markdown_comment(s):