mirror of
https://github.com/starship/starship.git
synced 2026-06-24 02:01:36 +07:00
test(battery): add battery tests (#2795)
Add some tests to the battery module, make it testable by mocking out the code that fetches battery info.
This commit is contained in:
@@ -121,6 +121,15 @@ impl<'a> ModuleRenderer<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(feature = "battery")]
|
||||
pub fn battery_info_provider(
|
||||
mut self,
|
||||
battery_info_provider: &'a (dyn crate::modules::BatteryInfoProvider + Send + Sync),
|
||||
) -> Self {
|
||||
self.context.battery_info_provider = battery_info_provider;
|
||||
self
|
||||
}
|
||||
|
||||
/// Renders the module returning its output
|
||||
pub fn collect(self) -> Option<String> {
|
||||
let ret = crate::print::get_module(self.name, self.context);
|
||||
|
||||
Reference in New Issue
Block a user