From 6fa25e6558f255e4465e6e57f098abba7372f380 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sat, 8 Jul 2017 18:15:07 +0200 Subject: [PATCH] Adapt parse error test --- src/test/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index 500aa858538..a464362c182 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -15,10 +15,12 @@ mod harness; use std::sync::{Arc, Mutex}; use env_logger; +use serde_json; use analysis; use config::Config; use server::{self as ls_server, ServerMessage, Request, Method}; +use jsonrpc_core; use vfs; use self::harness::{expect_messages, ExpectedMessage, init_env, mock_server, mock_server_with_config, RecordOutput, src}; @@ -459,5 +461,10 @@ fn test_parse_error_on_malformed_input() { let error = results.lock().unwrap() .pop().expect("no error response"); - assert!(error.contains(r#""code": -32700"#)) + + let failure: jsonrpc_core::Failure = serde_json::from_str(&error) + .expect("Couldn't parse json failure response"); + + const PARSE_ERROR: jsonrpc_core::ErrorCode = jsonrpc_core::ErrorCode::ParseError; + assert!(failure.error.code == PARSE_ERROR); }