Skip to content

Commit d512240

Browse files
committed
Add tests for #2830 and #2857
1 parent 2f03180 commit d512240

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

tests/source/macros.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,36 @@ macro_rules! bar {
393393
$m!([a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]);
394394
};
395395
}
396+
397+
// #2830
398+
// Preserve trailing comma-less/ness inside nested macro.
399+
named!(
400+
do_parse_gsv<GsvData>,
401+
map_res!(
402+
do_parse!(
403+
number_of_sentences: map_res!(digit, parse_num::<u16>)
404+
>> char!(',')
405+
>> sentence_index: map_res!(digit, parse_num::<u16>)
406+
>> char!(',')
407+
>> total_number_of_sats: map_res!(digit, parse_num::<u16>)
408+
>> char!(',')
409+
>> sat0: opt!(complete!(parse_gsv_sat_info))
410+
>> sat1: opt!(complete!(parse_gsv_sat_info))
411+
>> sat2: opt!(complete!(parse_gsv_sat_info))
412+
>> sat3: opt!(complete!(parse_gsv_sat_info))
413+
>> (
414+
number_of_sentences,
415+
sentence_index,
416+
total_number_of_sats,
417+
sat0,
418+
sat1,
419+
sat2,
420+
sat3
421+
)
422+
),
423+
construct_gsv_data
424+
)
425+
);
426+
427+
// #2857
428+
convert_args!(vec!(1, 2, 3));

tests/target/macros.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,3 +972,36 @@ macro_rules! bar {
972972
$m!([a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]);
973973
};
974974
}
975+
976+
// #2830
977+
// Preserve trailing comma-less/ness inside nested macro.
978+
named!(
979+
do_parse_gsv<GsvData>,
980+
map_res!(
981+
do_parse!(
982+
number_of_sentences: map_res!(digit, parse_num::<u16>)
983+
>> char!(',')
984+
>> sentence_index: map_res!(digit, parse_num::<u16>)
985+
>> char!(',')
986+
>> total_number_of_sats: map_res!(digit, parse_num::<u16>)
987+
>> char!(',')
988+
>> sat0: opt!(complete!(parse_gsv_sat_info))
989+
>> sat1: opt!(complete!(parse_gsv_sat_info))
990+
>> sat2: opt!(complete!(parse_gsv_sat_info))
991+
>> sat3: opt!(complete!(parse_gsv_sat_info))
992+
>> (
993+
number_of_sentences,
994+
sentence_index,
995+
total_number_of_sats,
996+
sat0,
997+
sat1,
998+
sat2,
999+
sat3
1000+
)
1001+
),
1002+
construct_gsv_data
1003+
)
1004+
);
1005+
1006+
// #2857
1007+
convert_args!(vec!(1, 2, 3));

0 commit comments

Comments
 (0)