From ffd4cd70e252faf2e5963b41bf654cf4698a0f90 Mon Sep 17 00:00:00 2001 From: Hidehito Yabuuchi Date: Thu, 4 Oct 2018 01:09:30 +0900 Subject: [PATCH] Capitalize static values in tests --- src/blkio.rs | 16 +++++++++------- src/memory.rs | 13 +++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/blkio.rs b/src/blkio.rs index 38863b3..5d5c156 100644 --- a/src/blkio.rs +++ b/src/blkio.rs @@ -681,7 +681,7 @@ mod test { use blkio::{parse_io_service, parse_io_service_total, IoService}; use CgroupError; - const test_value: &str = "\ + static TEST_VALUE: &str = "\ 8:32 Read 4280320 8:32 Write 0 8:32 Sync 4280320 @@ -704,7 +704,8 @@ mod test { 8:0 Total 7192576 Total 61823067136 "; - const test_wrong_value: &str = "\ + + static TEST_WRONG_VALUE: &str = "\ 8:32 Read 4280320 8:32 Write 0 8:32 Async 0 @@ -725,7 +726,8 @@ Total 61823067136 8:0 Total 7192576 Total 61823067136 "; - const test_blkio_data: &str = "\ + + static TEST_BLKIO_DATA: &str = "\ 8:48 454480833999 8:32 228392923193 8:16 772456885 @@ -735,7 +737,7 @@ Total 61823067136 #[test] fn test_parse_io_service_total() { assert_eq!( - parse_io_service_total(test_value.to_string()), + parse_io_service_total(TEST_VALUE.to_string()), Ok(61823067136) ); } @@ -743,7 +745,7 @@ Total 61823067136 #[test] fn test_parse_io_service() { assert_eq!( - parse_io_service(test_value.to_string()), + parse_io_service(TEST_VALUE.to_string()), Ok(vec![ IoService { major: 8, @@ -784,7 +786,7 @@ Total 61823067136 ]) ); assert_eq!( - parse_io_service(test_wrong_value.to_string()), + parse_io_service(TEST_WRONG_VALUE.to_string()), Err(CgroupError::ParseError) ); } @@ -792,7 +794,7 @@ Total 61823067136 #[test] fn test_parse_blkio_data() { assert_eq!( - parse_blkio_data(test_blkio_data.to_string()), + parse_blkio_data(TEST_BLKIO_DATA.to_string()), Ok(vec![ BlkIoData { major: 8, diff --git a/src/memory.rs b/src/memory.rs index 13d9a2b..0c72ecd 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -664,7 +664,8 @@ mod tests { use memory::{ parse_memory_stat, parse_numa_stat, parse_oom_control, MemoryStat, NumaStat, OomControl, }; - const good_value: &str = "\ + + static GOOD_VALUE: &str = "\ total=51189 N0=51189 N1=123 file=50175 N0=50175 N1=123 anon=1014 N0=1014 N1=123 @@ -675,13 +676,13 @@ hierarchical_anon=770402 N0=770402 N1=123 hierarchical_unevictable=20 N0=20 N1=123 "; - const good_oomcontrol_val: &str = "\ + static GOOD_OOMCONTROL_VAL: &str = "\ oom_kill_disable 0 under_oom 1 oom_kill 1337 "; - static good_memorystat_val: &str = "\ + static GOOD_MEMORYSTAT_VAL: &str = "\ cache 178880512 rss 4206592 rss_huge 0 @@ -723,7 +724,7 @@ total_unevictable 81920 #[test] fn test_parse_numa_stat() { assert_eq!( - parse_numa_stat(good_value.to_string()), + parse_numa_stat(GOOD_VALUE.to_string()), Ok(NumaStat { total_pages: 51189, total_pages_per_node: vec![51189, 123], @@ -749,7 +750,7 @@ total_unevictable 81920 #[test] fn test_parse_oom_control() { assert_eq!( - parse_oom_control(good_oomcontrol_val.to_string()), + parse_oom_control(GOOD_OOMCONTROL_VAL.to_string()), Ok(OomControl { oom_kill_disable: false, under_oom: true, @@ -761,7 +762,7 @@ total_unevictable 81920 #[test] fn test_parse_memory_stat() { assert_eq!( - parse_memory_stat(good_memorystat_val.to_string()), + parse_memory_stat(GOOD_MEMORYSTAT_VAL.to_string()), Ok(MemoryStat { cache: 178880512, rss: 4206592,