Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephTLyons committed Nov 20, 2024
1 parent 4382235 commit af551c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 37 deletions.
5 changes: 4 additions & 1 deletion test/data/integer/invalid_integer_data.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
36 changes: 0 additions & 36 deletions test/tokenizer_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit af551c0

Please sign in to comment.