Changeset 76 for trunk/src/cutest_sh_hash.c
- Timestamp:
- Dec 19, 2006, 10:01:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cutest_sh_hash.c
r33 r76 63 63 64 64 65 void Test_csv_escape_ok (CuTest *tc) { 66 #if defined(SH_WITH_CLIENT) || defined(SH_STANDALONE) 65 67 68 extern char * csv_escape(const char * str); 69 70 char test0[80]; 71 char expec[80]; 72 char *ret; 73 74 strcpy(test0, "foobar"); 75 strcpy(expec, "\"foobar\""); 76 ret = csv_escape(test0); 77 CuAssertStrEquals(tc, expec, ret); 78 79 strcpy(test0, "\"foobar\""); 80 strcpy(expec, "\"\"\"foobar\"\"\""); 81 ret = csv_escape(test0); 82 CuAssertStrEquals(tc, expec, ret); 83 84 strcpy(test0, "foo,bar"); 85 strcpy(expec, "\"foo,bar\""); 86 ret = csv_escape(test0); 87 CuAssertStrEquals(tc, expec, ret); 88 89 strcpy(test0, "foob,\"a\"r"); 90 strcpy(expec, "\"foob,\"\"a\"\"r\""); 91 ret = csv_escape(test0); 92 CuAssertStrEquals(tc, expec, ret); 93 94 strcpy(test0, "\",\"foobar\",\""); 95 strcpy(expec, "\"\"\",\"\"foobar\"\",\"\"\""); 96 ret = csv_escape(test0); 97 CuAssertStrEquals(tc, expec, ret); 98 99 strcpy(test0, ""); 100 strcpy(expec, ""); 101 ret = csv_escape(test0); 102 CuAssertStrEquals(tc, expec, ret); 103 104 strcpy(test0, "a"); 105 strcpy(expec, "\"a\""); 106 ret = csv_escape(test0); 107 CuAssertStrEquals(tc, expec, ret); 108 109 strcpy(test0, "foo\"bar"); 110 strcpy(expec, "\"foo\"\"bar\""); 111 ret = csv_escape(test0); 112 CuAssertStrEquals(tc, expec, ret); 113 114 #else 115 (void) tc; /* fix compiler warning */ 116 #endif 117 return; 118 } 119 120 121
Note:
See TracChangeset
for help on using the changeset viewer.