Skip to content
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions src/assail/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6561,6 +6561,31 @@ mod tests {
assert_eq!(Language::detect("page.jsx"), Language::JavaScript);
}

#[test]
fn analyze_affinescript_extension_reaches_dsl_analyzer() {
let tmp = TempDir::new().unwrap();
let affine_file = tmp.path().join("ffi_boundary.affine");
fs::write(
&affine_file,
"external one\nexternal two\nexternal three\nexternal four\n",
)
.unwrap();

assert_eq!(
Language::detect(affine_file.to_str().unwrap()),
Language::AffineScript
);

let report = Analyzer::new(&affine_file).unwrap().analyze().unwrap();
assert!(
report
.weak_points
.iter()
.any(|point| point.category == WeakPointCategory::UnsafeFFI),
".affine files must reach the AffineScript analyzer, not Unknown"
);
}

// ---------------------------------------------------------------
// 2. Analyzer::new() with a valid temp directory
// ---------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/assemblyline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ fn is_source_file(path: &Path) -> bool {
| "yaml"
| "yml"
| "json"
| "aff"
| "affine"
)
}

Expand Down Expand Up @@ -546,6 +548,7 @@ mod tests {
assert!(is_source_file(Path::new("lib.py")));
assert!(is_source_file(Path::new("app.js")));
assert!(is_source_file(Path::new("mod.gleam")));
assert!(is_source_file(Path::new("module.affine")));
assert!(!is_source_file(Path::new("image.png")));
assert!(!is_source_file(Path::new("binary.exe")));
assert!(!is_source_file(Path::new("readme.md")));
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl Language {
"jtv" => Language::JuliaTheViper,
"obli" => Language::Oblibeny,
"anvom" => Language::Anvomidav,
"aff" => Language::AffineScript,
"aff" | "affine" => Language::AffineScript,
"ephapax" | "eph" => Language::Ephapax,
"bet" => Language::BetLang,
"err" => Language::ErrorLang,
Expand Down
1 change: 1 addition & 0 deletions tests/types_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fn language_detect_nextgen_dsls() {
assert_eq!(Language::detect("script.woke"), Language::WokeLang);
assert_eq!(Language::detect("query.vcl"), Language::VCL);
assert_eq!(Language::detect("types.aff"), Language::AffineScript);
assert_eq!(Language::detect("types.affine"), Language::AffineScript);
}

#[test]
Expand Down
Loading