test_version.c (303975) | test_version.c (305313) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" | 1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" |
26__FBSDID("$FreeBSD: releng/11.0/contrib/libarchive/tar/test/test_version.c 299529 2016-05-12 10:16:16Z mm $"); | 26__FBSDID("$FreeBSD: releng/11.0/contrib/libarchive/tar/test/test_version.c 305313 2016-09-03 00:27:41Z mm $"); |
27 28/* 29 * Test that --version option works and generates reasonable output. 30 */ 31 32DEFINE_TEST(test_version) 33{ 34 int r; --- 48 unchanged lines hidden (view full) --- 83 while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) { 84 ++q; 85 --s; 86 } 87 /* Skip a single trailing a,b,c, or d. */ 88 if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') 89 ++q; 90 /* Skip arbitrary third-party version numbers. */ | 27 28/* 29 * Test that --version option works and generates reasonable output. 30 */ 31 32DEFINE_TEST(test_version) 33{ 34 int r; --- 48 unchanged lines hidden (view full) --- 83 while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) { 84 ++q; 85 --s; 86 } 87 /* Skip a single trailing a,b,c, or d. */ 88 if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') 89 ++q; 90 /* Skip arbitrary third-party version numbers. */ |
91 while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { | 91 while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || isalnum(*q))) { |
92 ++q; 93 --s; 94 } 95 /* All terminated by end-of-line. */ 96 assert(s >= 1); 97 /* Skip an optional CR character (e.g., Windows) */ 98 failure("Version output must end with \\n or \\r\\n"); 99 if (*q == '\r') { ++q; --s; } 100 assertEqualMem(q, "\n", 1); 101 free(p); 102} | 92 ++q; 93 --s; 94 } 95 /* All terminated by end-of-line. */ 96 assert(s >= 1); 97 /* Skip an optional CR character (e.g., Windows) */ 98 failure("Version output must end with \\n or \\r\\n"); 99 if (*q == '\r') { ++q; --s; } 100 assertEqualMem(q, "\n", 1); 101 free(p); 102} |