Skip to content

Commit

Permalink
Remove wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 6, 2023
1 parent dd69bb1 commit 5bb8255
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions crates/swc/tests/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,75 +426,3 @@ fn issue_4578() {
)
.unwrap();
}

#[test]
fn issue_6694() {
Tester::new().print_errors(|cm, handler| {
let c = Compiler::new(cm.clone());
let fm = cm.new_source_file(
swc_common::FileName::Real("./app.js".into()),
r#"console.log("test1") // line 1 correct
let text = `
1
1
1
1
1
1
`
console.log("test2") // this should be line 12, instead 17 in devtools
let test0
let test1
console.log("test3")"#
.replace('\n', "\r\n"),
);
let result = c.process_js_file(
fm,
&handler,
&Options {
swcrc: false,
source_maps: Some(SourceMapsConfig::Bool(true)),
config: Config {
jsc: JscConfig {
target: Some(swc_ecma_ast::EsVersion::Es5),
..Default::default()
},
is_module: IsModule::Bool(true),
inline_sources_content: true.into(),
emit_source_map_columns: true.into(),
..Default::default()
},
..Default::default()
},
);

match result {
Ok(result) => {
println!("{}", result.code);

assert!(result.map.is_some());
let map = result.map.unwrap();

let source_map = sourcemap::SourceMap::from_slice(map.as_bytes())
.expect("failed to deserialize sourcemap");

let token = source_map.lookup_token(1, 0).expect("failed to find token");
assert_eq!(token.get_src_line(), 0);
assert_eq!(token.get_src_col(), 38);

let token = source_map.lookup_token(4, 0).expect("failed to find token");
assert_eq!(token.get_src_line(), 11);
assert_eq!(token.get_src_col(), 83);
}
Err(err) => {
panic!("Error: {:#?}", err);
}
}

Ok(())
});
}

0 comments on commit 5bb8255

Please sign in to comment.