Changeset 2b30370
- Timestamp:
- Oct 20, 2021, 4:38:37 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 4e8df745
- Parents:
- 0ca15b7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/containers/string_res.cfa
r0ca15b7 r2b30370 209 209 // Store auto-newline state so it can be restored 210 210 bool anl = getANL$(out); 211 nlOff(out); 212 for (size_t i = 0; i < s.Handle.lnth; i++) { 213 // Need to re-apply on the last output operator, for whole-statement version 214 if (anl && i == s.Handle.lnth-1) nlOn(out); 215 out | s[i]; 216 } 217 return out; 211 if( s.Handle.lnth == 0 ) { 212 sout | ""; 213 } else { 214 nlOff(out); 215 for (size_t i = 0; i < s.Handle.lnth; i++) { 216 // Need to re-apply on the last output operator, for whole-statement version 217 if (anl && i == s.Handle.lnth-1) nlOn(out); 218 out | s[i]; 219 } 220 } 218 221 } 219 222 … … 223 226 (Handle){ * ambient_string_sharectx->activeHeap }; 224 227 (shareEditSet_owns_ulink){ false }; 228 verify( Handle.s == 0p && Handle.lnth == 0 ); 225 229 } else { 226 230 (Handle){ * new( (size_t) 10 ) }; // TODO: can I lazily avoid allocating for empty string 227 231 (shareEditSet_owns_ulink){ true }; 232 Handle.s = Handle.ulink->StartVbyte; 233 verify( Handle.lnth == 0 ); 228 234 } 229 235 s.shareEditSet_prev = &s; -
tests/collections/.expect/string-api-coverage.txt
r0ca15b7 r2b30370 1 1 hello hello hello 2 3 hello 2 4 true false 3 5 true false -
tests/collections/string-api-coverage.cfa
r0ca15b7 r2b30370 37 37 38 38 // IO operator, x2 39 sout | s | s | s; 39 sout | s | s | s; // hello hello hello 40 41 // empty ctor then assign 42 string sxx; 43 sout | sxx; // (blank line) 44 sxx = s; 45 sout | sxx; // hello 40 46 41 47 // Comparisons
Note: See TracChangeset
for help on using the changeset viewer.