History

move fully_sumed to test_util

Edward Shen committed 5 years ago

Commit 41245eb1 parent 568d3602 files · +12 −11Browse files

Unified · Split

2 files
  1. git-config/src/parser.rs +8 −11
  2. git-config/src/test_util.rs +4 −0
git-config/src/parser.rs+8−11
@@ -774,15 +774,10 @@ fn take_common<F: Fn(u8) -> bool>(i: &[u8], f: F) -> IResult<&[u8], &[u8]> { · 773 unmodified lines
774774 }
775775 }
776776
777−#[cfg(test)]
778−fn fully_consumed<T>(t: T) -> (&'static [u8], T) {
779− (&[], t)
780−}
781−
782777 #[cfg(test)]
783778 mod comments {
784779 use super::*;
785− use crate::test_util::comment as parsed_comment;
780+ use crate::test_util::{comment as parsed_comment, fully_consumed};
786781
787782 #[test]
788783 fn semicolon() {
@@ -812,7 +807,7 @@ mod comments { · 23 unmodified lines
812807 #[cfg(test)]
813808 mod section_headers {
814809 use super::*;
815− use crate::test_util::section_header as parsed_section_header;
810+ use crate::test_util::{fully_consumed, section_header as parsed_section_header};
816811
817812 #[test]
818813 fn no_subsection() {
@@ -884,6 +879,7 @@ mod section_headers { · 65 unmodified lines
884879 #[cfg(test)]
885880 mod config_name {
886881 use super::*;
882+ use crate::test_util::fully_consumed;
887883
888884 #[test]
889885 fn just_name() {
@@ -940,7 +936,7 @@ mod section_body { · 50 unmodified lines
940936 #[cfg(test)]
941937 mod value_no_continuation {
942938 use super::*;
943− use crate::test_util::value_event;
939+ use crate::test_util::{fully_consumed, value_event};
944940
945941 #[test]
946942 fn no_comment() {
@@ -1019,7 +1015,7 @@ mod value_no_continuation { · 72 unmodified lines
10191015 #[cfg(test)]
10201016 mod value_continuation {
10211017 use super::*;
1022− use crate::test_util::{newline_event, value_done_event, value_not_done_event};
1018+ use crate::test_util::{fully_consumed, newline_event, value_done_event, value_not_done_event};
10231019
10241020 #[test]
10251021 fn simple_continuation() {
@@ -1082,8 +1078,9 @@ mod value_continuation { · 56 unmodified lines
10821078 mod section {
10831079 use super::*;
10841080 use crate::test_util::{
1085− comment_event, name_event, newline_event, section_header as parsed_section_header,
1086− value_done_event, value_event, value_not_done_event, whitespace_event,
1081+ comment_event, fully_consumed, name_event, newline_event,
1082+ section_header as parsed_section_header, value_done_event, value_event,
1083+ value_not_done_event, whitespace_event,
10871084 };
10881085
10891086 #[test]
git-config/src/test_util.rs+4−0
@@ -67,3 +67,7 @@ pub(crate) fn comment(comment_tag: char, comment: &'static str) -> ParsedComment · 66 unmodified lines
6767 comment: Cow::Borrowed(comment.into()),
6868 }
6969 }
70+
71+pub(crate) fn fully_consumed<T>(t: T) -> (&'static [u8], T) {
72+ (&[], t)
73+}