MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / assert_has_strict_error

Function assert_has_strict_error

src/parse_to_ast.rs:584–602  ·  view source on GitHub ↗
(text: &str, message: &str)

Source from the content-addressed store, hash-verified

582
583 #[track_caller]
584 fn assert_has_strict_error(text: &str, message: &str) {
585 let result = parse_to_ast(
586 text,
587 &Default::default(),
588 &ParseOptions {
589 allow_comments: false,
590 allow_loose_object_property_names: false,
591 allow_trailing_commas: false,
592 allow_missing_commas: false,
593 allow_single_quoted_strings: false,
594 allow_hexadecimal_numbers: false,
595 allow_unary_plus_numbers: false,
596 },
597 );
598 match result {
599 Ok(_) => panic!("Expected error, but did not find one."),
600 Err(err) => assert_eq!(err.to_string(), message),
601 }
602 }
603
604 #[test]
605 fn it_should_not_include_tokens_by_default() {

Calls 1

parse_to_astFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…