@@ -40,16 +40,16 @@ use crate::core::BLOCK_LIMIT_MAINNET_21;
4040#[ allow( dead_code) ]
4141fn variant_coverage_report ( variant : ParseErrorKind ) {
4242 enum VariantCoverage {
43- // Cannot occur through valid execution
44- Unreachable_Functionally ,
43+ // Cannot occur through valid execution. The string is to explain the reason.
44+ Unreachable_Functionally ( & ' static str ) ,
4545 // Unexpected error, that should never happen
4646 Unreachable_ExpectLike ,
4747 // Defined but never used
4848 Unreachable_NotUsed ,
49- // Not tested on purpose
50- Ignored ,
51- // Covered by consensus tests
52- Tested ,
49+ // Not tested on purpose. The string is to explain the reason.
50+ Ignored ( & ' static str ) ,
51+ // Covered by consensus tests. The func lists is for to link the variant with the related tests
52+ Tested ( Vec < fn ( ) > ) ,
5353 }
5454
5555 use ParseErrorKind :: * ;
@@ -58,42 +58,45 @@ fn variant_coverage_report(variant: ParseErrorKind) {
5858 _ = match variant {
5959 // Costs
6060 CostOverflow => Unreachable_ExpectLike ,
61- CostBalanceExceeded ( _, _) => Tested ,
61+ CostBalanceExceeded ( _, _) => Tested ( vec ! [ test_cost_balance_exceeded ] ) ,
6262 MemoryBalanceExceeded ( _, _) => Unreachable_NotUsed ,
6363 CostComputationFailed ( _) => Unreachable_ExpectLike ,
6464 ExecutionTimeExpired => Unreachable_NotUsed ,
6565
6666 TooManyExpressions => Unreachable_ExpectLike ,
67- ExpressionStackDepthTooDeep => Tested ,
68- VaryExpressionStackDepthTooDeep => Tested ,
69- FailedParsingIntValue ( _) => Tested ,
70- CircularReference ( _) => Tested ,
71- NameAlreadyUsed ( _) => Tested ,
72- TraitReferenceNotAllowed => Tested ,
73- ImportTraitBadSignature => Tested ,
74- DefineTraitBadSignature => Tested ,
75- ImplTraitBadSignature => Tested ,
76- TraitReferenceUnknown ( _) => Tested ,
77-
78- Lexer ( LexerError ) => Tested ,
79- ContractNameTooLong ( String ) => Tested ,
80- ExpectedClosing ( Token ) => Tested ,
81- ExpectedContractIdentifier => Tested ,
82- ExpectedTraitIdentifier => Tested ,
83- ExpectedWhitespace => Tested ,
84- FailedParsingUIntValue ( _) => Tested ,
85- IllegalTraitName ( _) => Unreachable_Functionally , // prevented by Lexer checks returning `Lexer` variant
86- InvalidPrincipalLiteral => Tested ,
87- InvalidBuffer => Unreachable_Functionally , // prevented by both Lexer checks, and StacksTransaction::consensus_serialize with MAX_TRASACTION_LEN (panic)
88- NameTooLong ( _) => Tested ,
89- UnexpectedToken ( _) => Tested ,
90- TupleColonExpectedv2 => Tested ,
91- TupleCommaExpectedv2 => Tested ,
92- TupleValueExpected => Tested ,
93- IllegalClarityName ( _) => Unreachable_Functionally , // prevented by Lexer checks returning `Lexer` variant
94- IllegalASCIIString ( _) => Tested ,
95- IllegalContractName ( _) => Unreachable_Functionally , // prevented by Lexer checks returning `Lexer` variant or Parser by MAX_CONTRACT_NAME_LEN returning `ContractNameTooLong` variant
96- NoteToMatchThis ( _) => Tested ,
67+ ExpressionStackDepthTooDeep => Tested ( vec ! [
68+ test_stack_depth_too_deep_case_2_list_only_parsing,
69+ test_stack_depth_too_deep_case_2_list_only_parsing,
70+ test_stack_depth_too_deep_case_3_list_only_checker,
71+ ] ) ,
72+ VaryExpressionStackDepthTooDeep => Tested ( vec ! [ test_vary_stack_depth_too_deep_checker] ) ,
73+ FailedParsingIntValue ( _) => Tested ( vec ! [ test_failed_parsing_int_value] ) ,
74+ CircularReference ( _) => Tested ( vec ! [ test_circular_reference] ) ,
75+ NameAlreadyUsed ( _) => Tested ( vec ! [ test_named_already_used] ) ,
76+ TraitReferenceNotAllowed => Tested ( vec ! [ test_trait_ref_not_allowed] ) ,
77+ ImportTraitBadSignature => Tested ( vec ! [ test_import_trait_bad_signature] ) ,
78+ DefineTraitBadSignature => Tested ( vec ! [ test_define_trait_bad_signature] ) ,
79+ ImplTraitBadSignature => Tested ( vec ! [ test_impl_trait_bad_signature] ) ,
80+ TraitReferenceUnknown ( _) => Tested ( vec ! [ test_trait_reference_unknown] ) ,
81+ Lexer ( LexerError ) => Tested ( vec ! [ test_lexer_unknown_symbol] ) ,
82+ ContractNameTooLong ( String ) => Tested ( vec ! [ test_contract_name_too_long] ) ,
83+ ExpectedClosing ( Token ) => Tested ( vec ! [ test_expected_closing] ) ,
84+ ExpectedContractIdentifier => Tested ( vec ! [ test_expected_contract_identifier] ) ,
85+ ExpectedTraitIdentifier => Tested ( vec ! [ test_expected_trait_identifier] ) ,
86+ ExpectedWhitespace => Tested ( vec ! [ test_expected_white_space] ) ,
87+ FailedParsingUIntValue ( _) => Tested ( vec ! [ test_failed_parsing_uint_value] ) ,
88+ IllegalTraitName ( _) => Unreachable_Functionally ( "prevented by Lexer checks returning `Lexer` variant" ) ,
89+ InvalidPrincipalLiteral => Tested ( vec ! [ test_invalid_principal_literal] ) ,
90+ InvalidBuffer => Unreachable_Functionally ( "prevented by both Lexer checks, and StacksTransaction::consensus_serialize with MAX_TRANSACTION_LEN (panic)" ) ,
91+ NameTooLong ( _) => Tested ( vec ! [ test_name_too_long] ) ,
92+ UnexpectedToken ( _) => Tested ( vec ! [ test_unexpected_token] ) ,
93+ TupleColonExpectedv2 => Tested ( vec ! [ test_tuple_colon_expected_v2] ) ,
94+ TupleCommaExpectedv2 => Tested ( vec ! [ test_tuple_comma_expected_v2] ) ,
95+ TupleValueExpected => Tested ( vec ! [ test_tuple_value_expected] ) ,
96+ IllegalClarityName ( _) => Unreachable_Functionally ( "prevented by Lexer checks returning `Lexer` variant" ) ,
97+ IllegalASCIIString ( _) => Tested ( vec ! [ test_illegal_ascii_string] ) ,
98+ IllegalContractName ( _) => Unreachable_Functionally ( "prevented by Lexer checks returning `Lexer` variant or Parser by MAX_CONTRACT_NAME_LEN returning `ContractNameTooLong` variant" ) ,
99+ NoteToMatchThis ( _) => Tested ( vec ! [ test_note_to_match_this] ) ,
97100 UnexpectedParserFailure => Unreachable_ExpectLike ,
98101 InterpreterFailure => Unreachable_ExpectLike , // currently cause block rejection
99102
@@ -118,7 +121,7 @@ fn variant_coverage_report(variant: ParseErrorKind) {
118121 | CommaSeparatorUnexpected
119122 | ColonSeparatorUnexpected
120123 | InvalidCharactersDetected
121- | InvalidEscaping => Ignored , // parser v1 is deprecated and maybe removed in the next future.
124+ | InvalidEscaping => Ignored ( " parser v1 is deprecated and maybe removed in the next future." ) ,
122125 }
123126}
124127
0 commit comments