Replace row/column based Location with byte-offsets. (#3931)

This commit is contained in:
Micha Reiser 2023-04-26 20:11:02 +02:00 committed by GitHub
parent ee91598835
commit cab65b25da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
418 changed files with 6203 additions and 7040 deletions

View file

@ -1,10 +1,11 @@
#![cfg(target_arch = "wasm32")]
use js_sys;
use rustpython_parser::ast::Location;
use wasm_bindgen_test::*;
use ruff::registry::Rule;
use ruff_python_ast::source_code::{OneIndexed, SourceLocation};
use ruff_wasm::*;
macro_rules! check {
@ -28,8 +29,14 @@ fn empty_config() {
[ExpandedMessage {
code: Rule::IfTuple.noqa_code().to_string(),
message: "If test is a tuple, which is always `True`".to_string(),
location: Location::new(1, 0),
end_location: Location::new(2, 8),
location: SourceLocation {
row: OneIndexed::from_zero_indexed(0),
column: OneIndexed::from_zero_indexed(0)
},
end_location: SourceLocation {
row: OneIndexed::from_zero_indexed(1),
column: OneIndexed::from_zero_indexed(8)
},
fix: None,
}]
);