mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 10:09:01 -06:00
Merge PR #2702
This commit is contained in:
@@ -63,6 +63,13 @@ impl PlaceNames {
|
||||
self.lock().running
|
||||
}
|
||||
|
||||
/// Whether a place names download has been started in this session (running, or ended).
|
||||
#[cfg(test)]
|
||||
pub(crate) fn download_started(&self) -> bool {
|
||||
let sh = self.lock();
|
||||
sh.running || sh.last.is_some()
|
||||
}
|
||||
|
||||
/// The gazetteer in `dir`, parsed once and re-read only when the cities file's size or time changes.
|
||||
fn load(&mut self, dir: &Path) -> std::result::Result<Arc<GeoNames>, lightcraft_geocode::GeocodeError> {
|
||||
let file = dir.join(GEONAMES_FILES[0]);
|
||||
|
||||
@@ -452,8 +452,14 @@ fn command_sweep() {
|
||||
for c in command_specs() {
|
||||
assert!(ids.insert(c.id), "duplicate {}", c.id);
|
||||
assert!(!c.label.is_empty() && !c.params.is_empty(), "{}", c.id);
|
||||
// empty params make this one download from download.geonames.org into the real settings folder; its own tests run it against a loopback server
|
||||
if c.id == "metadata.downloadPlaceNames" {
|
||||
continue;
|
||||
}
|
||||
let _ = s.execute(c.id, &Value::Null);
|
||||
}
|
||||
// empty params must never start a download from the internet
|
||||
assert!(!s.place_names.download_started(), "the sweep started a place names download");
|
||||
assert!(s.commands().len() >= 70, "{}", s.commands().len());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user