Skip to content

Instantly share code, notes, and snippets.

@polybuildr
Last active March 31, 2017 16:24
Show Gist options
  • Save polybuildr/dd8dafc61055494efaf32a617adf2221 to your computer and use it in GitHub Desktop.
Save polybuildr/dd8dafc61055494efaf32a617adf2221 to your computer and use it in GitHub Desktop.
#[test]
fn check_reference_error() {
let result = check_and_get_result("var x = 5; y;");
let errors = result.unwrap_err();
assert_eq!(errors.len(), 1);
let &(ref error, ref span) = errors.get(0).unwrap();
assert_eq!(*error, TypeCheckerIssue::InterpreterError(InterpreterError::ReferenceError("y".to_owned())));
}
@polybuildr
Copy link
Author

Ideally, what I would like to express this as is:

assert_eq!(
    errors,
    vec![InterpreterError::ReferenceError("y".to_owned()).into()]
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment