From 72ec565678c7a287408545d02a886da78669356d Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Sun, 12 Jul 2020 05:38:11 +0300 Subject: [PATCH] fix localization test --- .gitlab/CI/build.gitlab-ci.yml | 4 ++-- voxygen/tests/check_i18n_files.rs | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitlab/CI/build.gitlab-ci.yml b/.gitlab/CI/build.gitlab-ci.yml index 8717d04f0e..f051c3dd47 100644 --- a/.gitlab/CI/build.gitlab-ci.yml +++ b/.gitlab/CI/build.gitlab-ci.yml @@ -21,7 +21,7 @@ localization-status: extends: .recompile-branch stage: build variables: - GIT_DEPTH: 0 + GIT_DEPTH: 9999999999999 allow_failure: true script: - ln -s /dockercache/cache-all target @@ -110,4 +110,4 @@ opt-windows: opt-macos: extends: - .tmacos - - .optional-release \ No newline at end of file + - .optional-release diff --git a/voxygen/tests/check_i18n_files.rs b/voxygen/tests/check_i18n_files.rs index 1fbbbd7b51..2753a01766 100644 --- a/voxygen/tests/check_i18n_files.rs +++ b/voxygen/tests/check_i18n_files.rs @@ -108,7 +108,10 @@ fn generate_key_version<'a>( .iter() .for_each(|e: git2::BlameHunk| { for state in keys.values_mut() { - let line = state.key_line.unwrap(); + let line = match state.key_line { + Some(l) => l, + None => continue, + }; if line >= e.final_start_line() && line < e.final_start_line() + e.lines_in_hunk() { state.chuck_line_range = Some(( @@ -176,14 +179,25 @@ fn test_all_localizations<'a>() { // Find the localization entry state let current_blob = read_file_from_path(&repo, &head_ref, &relfile); - let current_loc: VoxygenLocalization = - from_bytes(current_blob.content()).expect("Expect to parse the RON file"); + let current_loc: VoxygenLocalization = match from_bytes(current_blob.content()) { + Ok(v) => v, + Err(e) => { + eprintln!("Could not parse RON file, skipping: {}", e); + continue; + }, + }; let mut current_i18n = generate_key_version(&repo, ¤t_loc, &relfile, ¤t_blob); for (ref_key, ref_state) in i18n_references.iter() { match current_i18n.get_mut(ref_key) { Some(state) => { - let commit_id = state.commit_id.unwrap(); - let ref_commit_id = ref_state.commit_id.unwrap(); + let commit_id = match state.commit_id { + Some(c) => c, + None => continue, + }; + let ref_commit_id = match ref_state.commit_id { + Some(c) => c, + None => continue, + }; if commit_id != ref_commit_id && !repo .graph_descendant_of(commit_id, ref_commit_id)