diff --git a/test/data/integer/invalid_integer_data.gleam b/test/data/integer/invalid_integer_data.gleam index f2abae7..6bf6627 100644 --- a/test/data/integer/invalid_integer_data.gleam +++ b/test/data/integer/invalid_integer_data.gleam @@ -682,7 +682,10 @@ fn invalid_mixed() -> List(IntegerTestData) { expected_program_output: Error(UnknownCharacter(7, ".")), python_error_function: invalid_literal_for_int_error, ), - // Base 0, has no prefix, default to decimal - should not parse leading 0 as it is followed by a digit + // Base 0, has no prefix, default to decimal - should not parse with lead 0 + // because a leading 0 is considered a flag for start of base prefix string + // and we are missing the specifier. When in base 0, to parse a string as + // base 10, it must not have a leading 0. integer_test_data( input: "01", base: base_0, diff --git a/test/tokenizer_test.gleam b/test/tokenizer_test.gleam index caa31be..0142b35 100644 --- a/test/tokenizer_test.gleam +++ b/test/tokenizer_test.gleam @@ -355,34 +355,6 @@ pub fn tokenize_int_with_uppercase_hexadecimal_prefix_and_base_0_test() { ]) } -// Ensure that we don't tokenize the trailing `0b` as a base prefix when including already including the leading base prefix. -pub fn tokenize_int_with_leading_base_prefix_and_trailing_base_prefix_substrings_as_digits_test() { - "0XABC0b" - |> tokenizer.tokenize_int - |> expect.to_equal([ - Digit(#(0, 1), "0", 0), - Digit(#(1, 2), "X", 33), - Digit(#(2, 3), "A", 10), - Digit(#(3, 4), "B", 11), - Digit(#(4, 5), "C", 12), - Digit(#(5, 6), "0", 0), - Digit(#(6, 7), "b", 11), - ]) -} - -// Ensure that we don't tokenize the trailing `0b` as a base prefix omitting the leading base prefix. -pub fn tokenize_int_with_trailing_base_prefix_substrings_as_digits_test() { - "ABC0b" - |> tokenizer.tokenize_int - |> expect.to_equal([ - Digit(#(0, 1), "A", 10), - Digit(#(1, 2), "B", 11), - Digit(#(2, 3), "C", 12), - Digit(#(3, 4), "0", 0), - Digit(#(4, 5), "b", 11), - ]) -} - pub fn tokenize_int_with_no_prefix_and_base_0_test() { " \n+1990_04_12.0e4 " |> tokenizer.tokenize_int @@ -447,14 +419,6 @@ pub fn tokenize_int_with_base_16_and_hexadecimal_prefix_test() { ]) } -// Invalid base specifier tests - -pub fn tokenize_int_invalid_base_specifier_test() { - "01" - |> tokenizer.tokenize_int - |> expect.to_equal([Digit(#(0, 1), "0", 0), Digit(#(1, 2), "1", 1)]) -} - // ---- Tests for all whitespace characters pub fn tokenize_int_with_all_whitespace_characters_test() {