()
| 864 | |
| 865 | #[test] |
| 866 | fn test_compact_number() { |
| 867 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, false, 3, 0.8)); |
| 868 | let sc = SourceCursor::from(c, r"0.8"); |
| 869 | assert_eq!(format!("{}", sc), r"0.8"); |
| 870 | assert_eq!(format!("{}", sc.compact()), ".8"); |
| 871 | |
| 872 | let c = Cursor::new(SourceOffset(0), Token::new_number(false, false, 3, 1.0)); |
| 873 | let sc = SourceCursor::from(c, r"001"); |
| 874 | assert_eq!(format!("{}", sc), r"001"); |
| 875 | assert_eq!(format!("{}", sc.compact()), "1"); |
| 876 | |
| 877 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, true, 8, 1.0)); |
| 878 | let sc = SourceCursor::from(c, r"+1.00000"); |
| 879 | assert_eq!(format!("{}", sc), r"+1.00000"); |
| 880 | assert_eq!(format!("{}", sc.compact()), "1"); |
| 881 | |
| 882 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, true, 8, 1.0).with_sign_required()); |
| 883 | let sc = SourceCursor::from(c, r"+1.00000"); |
| 884 | assert_eq!(format!("{}", sc), r"+1.00000"); |
| 885 | assert_eq!(format!("{}", sc.compact()), "+1"); |
| 886 | |
| 887 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, false, 4, 0.01)); |
| 888 | let sc = SourceCursor::from(c, r"0.01"); |
| 889 | assert_eq!(format!("{}", sc), r"0.01"); |
| 890 | assert_eq!(format!("{}", sc.compact()), ".01"); |
| 891 | |
| 892 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, false, 5, -0.01)); |
| 893 | let sc = SourceCursor::from(c, r"-0.01"); |
| 894 | assert_eq!(format!("{}", sc), r"-0.01"); |
| 895 | assert_eq!(format!("{}", sc.compact()), "-.01"); |
| 896 | |
| 897 | let c = Cursor::new(SourceOffset(0), Token::new_number(true, false, 4, 0.06)); |
| 898 | let sc = SourceCursor::from(c, r"0.06"); |
| 899 | assert_eq!(format!("{}", sc), r"0.06"); |
| 900 | assert_eq!(format!("{}", sc.compact()), ".06"); |
| 901 | } |
| 902 | |
| 903 | #[test] |
| 904 | fn test_compact_dimension() { |
nothing calls this directly
no test coverage detected