Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions src-tauri/src/commands/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,19 @@ std = []"#;
println!("Found {} Java tokens", tokens.len());

let token_types: Vec<&str> = tokens.iter().map(|t| t.token_type.as_str()).collect();
assert!(token_types.contains(&"keyword"), "Should have keyword tokens");
assert!(
token_types.contains(&"keyword"),
"Should have keyword tokens"
);
assert!(token_types.contains(&"string"), "Should have string tokens");
assert!(token_types.contains(&"identifier"), "Should have identifier tokens");
assert!(token_types.contains(&"function"), "Should have function tokens");
assert!(
token_types.contains(&"identifier"),
"Should have identifier tokens"
);
assert!(
token_types.contains(&"function"),
"Should have function tokens"
);
}

#[test]
Expand All @@ -515,9 +524,15 @@ int main() {
println!("Found {} C tokens", tokens.len());

let token_types: Vec<&str> = tokens.iter().map(|t| t.token_type.as_str()).collect();
assert!(token_types.contains(&"keyword"), "Should have keyword tokens");
assert!(
token_types.contains(&"keyword"),
"Should have keyword tokens"
);
assert!(token_types.contains(&"string"), "Should have string tokens");
assert!(token_types.contains(&"identifier"), "Should have identifier tokens");
assert!(
token_types.contains(&"identifier"),
"Should have identifier tokens"
);
assert!(token_types.contains(&"number"), "Should have number tokens");
}

Expand Down Expand Up @@ -549,8 +564,14 @@ int main() {

let token_types: Vec<&str> = tokens.iter().map(|t| t.token_type.as_str()).collect();
assert!(!tokens.is_empty(), "Should have tokens");
assert!(token_types.contains(&"keyword"), "Should have keyword tokens");
assert!(token_types.contains(&"function") || token_types.contains(&"identifier"), "Should have function or identifier tokens");
assert!(
token_types.contains(&"keyword"),
"Should have keyword tokens"
);
assert!(
token_types.contains(&"function") || token_types.contains(&"identifier"),
"Should have function or identifier tokens"
);
}

#[test]
Expand Down Expand Up @@ -578,10 +599,19 @@ $user->greet();
println!("Found {} PHP tokens", tokens.len());

let token_types: Vec<&str> = tokens.iter().map(|t| t.token_type.as_str()).collect();
assert!(token_types.contains(&"keyword"), "Should have keyword tokens");
assert!(
token_types.contains(&"keyword"),
"Should have keyword tokens"
);
assert!(token_types.contains(&"string"), "Should have string tokens");
assert!(token_types.contains(&"identifier"), "Should have identifier tokens");
assert!(token_types.contains(&"function"), "Should have function tokens");
assert!(
token_types.contains(&"identifier"),
"Should have identifier tokens"
);
assert!(
token_types.contains(&"function"),
"Should have function tokens"
);
}

#[test]
Expand Down