@@ -468,6 +468,62 @@ line-length = 500
468468 "line-length must be between 1 and 320 (got 500)"
469469 ) ;
470470
471+ // Test value at u16::MAX boundary (65535) - should show range error
472+ let invalid_line_length_65535 = toml:: from_str :: < Pyproject > (
473+ r"
474+ [tool.ruff]
475+ line-length = 65535
476+ " ,
477+ )
478+ . expect_err ( "Deserialization should have failed for line-length at u16::MAX" ) ;
479+
480+ assert_eq ! (
481+ invalid_line_length_65535. message( ) ,
482+ "line-length must be between 1 and 320 (got 65535)"
483+ ) ;
484+
485+ // Test value exceeding u16::MAX (65536) - should show clear error
486+ let invalid_line_length_65536 = toml:: from_str :: < Pyproject > (
487+ r"
488+ [tool.ruff]
489+ line-length = 65536
490+ " ,
491+ )
492+ . expect_err ( "Deserialization should have failed for line-length exceeding u16::MAX" ) ;
493+
494+ assert_eq ! (
495+ invalid_line_length_65536. message( ) ,
496+ "line-length must be between 1 and 320 (got 65536)"
497+ ) ;
498+
499+ // Test value far exceeding u16::MAX (99_999) - should show clear error
500+ let invalid_line_length_99999 = toml:: from_str :: < Pyproject > (
501+ r"
502+ [tool.ruff]
503+ line-length = 99_999
504+ " ,
505+ )
506+ . expect_err ( "Deserialization should have failed for line-length far exceeding u16::MAX" ) ;
507+
508+ assert_eq ! (
509+ invalid_line_length_99999. message( ) ,
510+ "line-length must be between 1 and 320 (got 99999)"
511+ ) ;
512+
513+ // Test negative value - should show clear error
514+ let invalid_line_length_negative = toml:: from_str :: < Pyproject > (
515+ r"
516+ [tool.ruff]
517+ line-length = -5
518+ " ,
519+ )
520+ . expect_err ( "Deserialization should have failed for negative line-length" ) ;
521+
522+ assert_eq ! (
523+ invalid_line_length_negative. message( ) ,
524+ "line-length must be between 1 and 320 (got -5)"
525+ ) ;
526+
471527 Ok ( ( ) )
472528 }
473529
0 commit comments