0

Here's my code,

invalid_VB_file = """
'C' * (65535 + 1)
"""

LineLengthBearLangSpecificAspectTest = verify_local_bear(
    LineLengthBear,
    valid_files=(test_file,),
    invalid_files=(invalid_VB_file,),
    aspects=AspectList([
        get_aspect('LineLength')('VisualBasic', max_line_length=4),
        ]),
    settings={'language': 'VisualBasic'},
        )

So basically, it ignores max_line_length=4 and picks up the already defined limit of 65535 for the Visual Basic file. The problem I am facing is the LineLengthBear gives me 18 as the length of the line in invalid_VB_test and renders the test as valid, thus, the test fails. Is there any way to write an invalid test i.e. a line longer than 65535 characters, without literally writing such a long line?

1 Answers1

0

Your string is literally "'C' * (65535 + 1)". If you actually want a line of 65536 Cs, then take it out of the quotes:

invalid_VB_file = 'C' * (65535 + 1)
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895