Get remaining language2 tests passing

This commit is contained in:
Max Brunsfeld 2023-10-26 16:38:42 +02:00
parent 0eae962abf
commit 65045b9c52
4 changed files with 1475 additions and 1471 deletions

View file

@ -76,36 +76,36 @@ impl Default for HighlightId {
}
}
// #[cfg(test)]
// mod tests {
// use super::*;
// use gpui2::color::Color;
#[cfg(test)]
mod tests {
use super::*;
use gpui2::rgba;
// #[test]
// fn test_highlight_map() {
// let theme = SyntaxTheme::new(
// [
// ("function", Color::from_u32(0x100000ff)),
// ("function.method", Color::from_u32(0x200000ff)),
// ("function.async", Color::from_u32(0x300000ff)),
// ("variable.builtin.self.rust", Color::from_u32(0x400000ff)),
// ("variable.builtin", Color::from_u32(0x500000ff)),
// ("variable", Color::from_u32(0x600000ff)),
// ]
// .iter()
// .map(|(name, color)| (name.to_string(), (*color).into()))
// .collect(),
// );
#[test]
fn test_highlight_map() {
let theme = SyntaxTheme {
highlights: [
("function", rgba(0x100000ff)),
("function.method", rgba(0x200000ff)),
("function.async", rgba(0x300000ff)),
("variable.builtin.self.rust", rgba(0x400000ff)),
("variable.builtin", rgba(0x500000ff)),
("variable", rgba(0x600000ff)),
]
.iter()
.map(|(name, color)| (name.to_string(), (*color).into()))
.collect(),
};
// let capture_names = &[
// "function.special".to_string(),
// "function.async.rust".to_string(),
// "variable.builtin.self".to_string(),
// ];
let capture_names = &[
"function.special".to_string(),
"function.async.rust".to_string(),
"variable.builtin.self".to_string(),
];
// let map = HighlightMap::new(capture_names, &theme);
// assert_eq!(map.get(0).name(&theme), Some("function"));
// assert_eq!(map.get(1).name(&theme), Some("function.async"));
// assert_eq!(map.get(2).name(&theme), Some("variable.builtin"));
// }
// }
let map = HighlightMap::new(capture_names, &theme);
assert_eq!(map.get(0).name(&theme), Some("function"));
assert_eq!(map.get(1).name(&theme), Some("function.async"));
assert_eq!(map.get(2).name(&theme), Some("variable.builtin"));
}
}