chore: typo fix and some structure adjust

This commit is contained in:
ShootingStarDragons 2025-03-30 22:07:38 +09:00
parent e5eeef97b2
commit cdf19c566e
36 changed files with 25 additions and 23 deletions

View file

@ -236,7 +236,7 @@ mod ast_test {
use super::*;
#[test]
fn test_ast_1() {
let context = include_str!("../assert/ast_test/bast_test.cmake");
let context = include_str!("../assets_for_test/ast_test/bast_test.cmake");
let mut parse = tree_sitter::Parser::new();
parse.set_language(&TREESITTER_CMAKE_LANGUAGE).unwrap();
let thetree = parse.parse(context, None).unwrap();
@ -246,7 +246,7 @@ mod ast_test {
#[test]
fn test_ast_2() {
let context = include_str!("../assert/ast_test/nheko_test.cmake");
let context = include_str!("../assets_for_test/ast_test/nheko_test.cmake");
let mut parse = tree_sitter::Parser::new();
parse.set_language(&TREESITTER_CMAKE_LANGUAGE).unwrap();
let thetree = parse.parse(context, None).unwrap();

View file

@ -256,7 +256,7 @@ mod tests {
#[test]
fn tst_cmake_command_builtin() {
// NOTE: In case the command fails, ignore test
let output = include_str!("../../assert/cmake_help_commands.txt");
let output = include_str!("../../assets_for_test/cmake_help_commands.txt");
let output = gen_builtin_commands(&output);
@ -266,7 +266,7 @@ mod tests {
#[test]
fn tst_cmake_variables_builtin() {
// NOTE: In case the command fails, ignore test
let output = include_str!("../../assert/cmake_help_variables.txt");
let output = include_str!("../../assets_for_test/cmake_help_variables.txt");
let output = gen_builtin_variables(&output);
@ -276,7 +276,7 @@ mod tests {
#[test]
fn tst_cmake_modules_builtin() {
// NOTE: In case the command fails, ignore test
let output = include_str!("../../assert/cmake_help_commands.txt");
let output = include_str!("../../assets_for_test/cmake_help_commands.txt");
let output = gen_builtin_modules(&output);

View file

@ -118,17 +118,17 @@ mod api_test {
#[test]
fn test_serde() {
let origin_json = include_str!("../assert/fileapi/api.json");
let origin_json = include_str!("../assets_for_test/fileapi/api.json");
let json = QueryJson::new(origin_json).unwrap();
let final_json = include_str!("../assert/fileapi/fileapifinal.json");
let final_json = include_str!("../assets_for_test/fileapi/fileapifinal.json");
let json_target: QueryJson = serde_json::from_str(&final_json).unwrap();
assert_eq!(json_target, json);
let _cache: Cache = serde_json::from_str(include_str!(
"../assert/fileapi/cache-v2-c1f0b50299da00258c61.json"
"../assets_for_test/fileapi/cache-v2-c1f0b50299da00258c61.json"
))
.unwrap();
}

View file

@ -248,8 +248,8 @@ pub fn get_format_cli(
#[cfg(unix)]
#[test]
fn tst_format_function() {
let source = include_str!("../assert/function/formatbefore.cmake");
let sourceafter = include_str!("../assert/function/formatafter.cmake");
let source = include_str!("../assets_for_test/function/formatbefore.cmake");
let sourceafter = include_str!("../assets_for_test/function/formatafter.cmake");
let formatstr = get_format_cli(source, 1, false, false).unwrap();
let formatstr_with_lastline = get_format_cli(source, 1, false, true).unwrap();
assert_eq!(formatstr.as_str(), sourceafter);
@ -259,8 +259,8 @@ fn tst_format_function() {
#[cfg(unix)]
#[test]
fn tst_format_base() {
let source = include_str!("../assert/base/formatbefore.cmake");
let sourceafter = include_str!("../assert/base/formatafter.cmake");
let source = include_str!("../assets_for_test/base/formatbefore.cmake");
let sourceafter = include_str!("../assets_for_test/base/formatafter.cmake");
let formatstr = get_format_cli(source, 1, false, false).unwrap();
let formatstr_with_lastline = get_format_cli(source, 1, false, true).unwrap();
assert_eq!(formatstr.as_str(), sourceafter);
@ -270,8 +270,8 @@ fn tst_format_base() {
#[cfg(unix)]
#[test]
fn tst_format_lastline() {
let source = include_str!("../assert/lastline/before.cmake");
let sourceafter = include_str!("../assert/lastline/after.cmake");
let source = include_str!("../assets_for_test/lastline/before.cmake");
let sourceafter = include_str!("../assets_for_test/lastline/after.cmake");
let formatstr = get_format_cli(source, 4, true, false).unwrap();
let formatstr_with_lastline = get_format_cli(source, 4, true, true).unwrap();
assert_eq!(formatstr.as_str(), sourceafter);

View file

@ -454,7 +454,7 @@ include(abcd.text)
#[test]
fn gammer_passed_check_1() {
let source = include_str!("../assert/gammar/include_check.cmake");
let source = include_str!("../assets_for_test/gammar/include_check.cmake");
let mut parse = tree_sitter::Parser::new();
parse.set_language(&TREESITTER_CMAKE_LANGUAGE).unwrap();
let thetree = parse.parse(&source, None).unwrap();
@ -480,7 +480,7 @@ fn gammer_passed_check_1() {
#[test]
fn gammer_passed_check_2() {
let source = include_str!("../assert/gammar/pass_test.cmake");
let source = include_str!("../assets_for_test/gammar/pass_test.cmake");
let mut parse = tree_sitter::Parser::new();
parse.set_language(&TREESITTER_CMAKE_LANGUAGE).unwrap();
let thetree = parse.parse(&source, None).unwrap();

View file

@ -454,5 +454,7 @@ fn test_hl() {
),
}))
}
semantic_token_test(include_str!("../assert/highlight/bracket_argument.cmake"));
semantic_token_test(include_str!(
"../assets_for_test/highlight/bracket_argument.cmake"
));
}

View file

@ -401,6 +401,6 @@ fn tst_version() {
assert_eq!(get_version(projectversion), Some("5.11".to_string()));
let projectversion = "SET(PACKAGE_VERSION 5.11)";
assert_eq!(get_version(projectversion), Some("5.11".to_string()));
let qmlversion = include_str!("../../assert/Qt5QmlConfigVersion.cmake");
let qmlversion = include_str!("../../assets_for_test/Qt5QmlConfigVersion.cmake");
assert_eq!(get_version(qmlversion), Some("5.15.6".to_string()));
}

View file

@ -1,9 +1,9 @@
use std::process::Command;
use assert_cmd::cargo::CommandCargoExt;
use regex::{Captures, Regex};
#[allow(unused)]
fn compare_shell_completions(shell: &str, completion_script: &str) {
use std::process::Command;
use assert_cmd::cargo::CommandCargoExt;
use regex::{Captures, Regex};
let mut command = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
command.env("COMPLETE", shell);