3 fn same(fmt
: &'
static str, p
: &[Piece
<'
static>]) {
4 let parser
= Parser
::new(fmt
, None
, vec
![], false);
5 assert
!(parser
.collect
::<Vec
<Piece
<'
static>>>() == p
);
8 fn fmtdflt() -> FormatSpec
<'
static> {
13 precision
: CountImplied
,
22 let mut p
= Parser
::new(s
, None
, vec
![], false);
24 assert
!(!p
.errors
.is_empty());
29 same("asdf", &[String("asdf")]);
30 same("a{{b", &[String("a"), String("{b")]);
31 same("a}}b", &[String("a"), String("}b")]);
32 same("a}}", &[String("a"), String("}")]);
33 same("}}", &[String("}")]);
34 same("\\}}", &[String("\\"), String("}")]);
61 &[NextArgument(Argument
{
62 position
: ArgumentImplicitlyIs(0),
67 fn format_position() {
69 &[NextArgument(Argument
{
70 position
: ArgumentIs(3),
75 fn format_position_nothing_else() {
77 &[NextArgument(Argument
{
78 position
: ArgumentIs(3),
86 &[NextArgument(Argument
{
87 position
: ArgumentIs(3),
92 precision
: CountImplied
,
101 fn format_align_fill() {
104 &[NextArgument(Argument
{
105 position
: ArgumentIs(3),
110 precision
: CountImplied
,
112 precision_span
: None
,
119 &[NextArgument(Argument
{
120 position
: ArgumentIs(3),
125 precision
: CountImplied
,
127 precision_span
: None
,
134 &[NextArgument(Argument
{
135 position
: ArgumentIs(3),
140 precision
: CountImplied
,
142 precision_span
: None
,
150 use syntax_pos
::{GLOBALS, Globals, edition}
;
151 GLOBALS
.set(&Globals
::new(edition
::DEFAULT_EDITION
), || {
154 &[NextArgument(Argument
{
155 position
: ArgumentImplicitlyIs(0),
160 precision
: CountImplied
,
162 precision_span
: None
,
169 &[NextArgument(Argument
{
170 position
: ArgumentImplicitlyIs(0),
175 precision
: CountIs(10),
176 width
: CountIsParam(10),
177 precision_span
: None
,
178 width_span
: Some(InnerSpan
::new(3, 6)),
184 &[NextArgument(Argument
{
185 position
: ArgumentImplicitlyIs(1),
190 precision
: CountIsParam(0),
192 precision_span
: Some(InnerSpan
::new(3, 5)),
199 &[NextArgument(Argument
{
200 position
: ArgumentImplicitlyIs(0),
205 precision
: CountIsParam(10),
207 precision_span
: Some(InnerSpan
::new(3, 7)),
214 &[NextArgument(Argument
{
215 position
: ArgumentImplicitlyIs(0),
220 precision
: CountIsName(Symbol
::intern("b")),
221 width
: CountIsName(Symbol
::intern("a")),
222 precision_span
: None
,
233 &[NextArgument(Argument
{
234 position
: ArgumentImplicitlyIs(0),
238 flags
: (1 << FlagSignMinus
as u32),
239 precision
: CountImplied
,
241 precision_span
: None
,
248 &[NextArgument(Argument
{
249 position
: ArgumentImplicitlyIs(0),
253 flags
: (1 << FlagSignPlus
as u32) | (1 << FlagAlternate
as u32),
254 precision
: CountImplied
,
256 precision_span
: None
,
263 fn format_mixture() {
268 NextArgument(Argument
{
269 position
: ArgumentIs(3),
274 precision
: CountImplied
,
276 precision_span
: None
,