Fix stdio/scanf test case
inner_scanf prematurely exited before parsing collected string
This commit is contained in:
@@ -222,7 +222,7 @@ unsafe fn inner_scanf(
|
||||
r.commit();
|
||||
width = width.map(|w| w - 1);
|
||||
if width.map(|w| w > 0).unwrap_or(true) && !read!() {
|
||||
return Ok(matched);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ void test(char* fmt_in, char* input, struct params *p, ...) {
|
||||
int main(void) {
|
||||
struct params p = { .c = 'a' };
|
||||
|
||||
test("%hhd %d", "12 345", &p, &p.sa, &p.ia);
|
||||
test("%hd %d", "12 345", &p, &p.sa, &p.ia);
|
||||
test("%x %i %i", "12 0x345 010", &p, &p.ia, &p.ib, &p.ic);
|
||||
test("%f.%lf", "0.1.0.2", &p, &p.fa, &p.da);
|
||||
test("%p", "0xABCDEF", &p, &p.ptr);
|
||||
|
||||
Reference in New Issue
Block a user