2020-08-17 13:48:53 +00:00
|
|
|
use async_graphql::*;
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
pub async fn test_mut_args() {
|
|
|
|
struct Query;
|
|
|
|
|
2020-09-18 00:52:13 +00:00
|
|
|
#[Object]
|
2020-08-17 13:48:53 +00:00
|
|
|
impl Query {
|
|
|
|
async fn test(&self, mut a: i32, mut b: String) -> String {
|
|
|
|
a += 1;
|
|
|
|
b += "a";
|
|
|
|
format!("{}{}", a, b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();
|
|
|
|
assert_eq!(
|
2020-09-10 11:35:48 +00:00
|
|
|
schema.execute("{ test(a: 10, b: \"abc\") }").await.data,
|
2020-08-17 13:48:53 +00:00
|
|
|
serde_json::json!({
|
|
|
|
"test": "11abca"
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|