| 198 | { |
| 199 | native_char_t storage[32] = {}; |
| 200 | StringSpan::NativeWritable writable; |
| 201 | writable.writableSpan = storage; |
| 202 | size_t count = 0; |
| 203 | size_t starts[1] = {}; |
| 204 | StringsArena arena(writable, count, starts, |
| 205 | Result::Error(ProcessResultCategory, ProcessError::ArgumentCapacityExceeded)); |
| 206 | const StringSpan first = SC_NATIVE_STR("first"); |
| 207 | const StringSpan second = SC_NATIVE_STR("second"); |
| 208 | SC_TEST_EXPECT(arena.appendAsSingleString(first)); |
| 209 | SC_TEST_EXPECT( |
| 210 | arena.appendAsSingleString(second).isError(ProcessResultCategory, ProcessError::ArgumentCapacityExceeded)); |
| 211 | SC_TEST_EXPECT(arena.writeTo({}).isError(ProcessResultCategory, ProcessError::ArgumentCapacityExceeded)); |
| 212 | |
| 213 | size_t emptyCount = 0; |
| 214 | StringsArena environmentStringsArena( |
| 215 | writable, emptyCount, Span<size_t>(), |
| 216 | Result::Error(ProcessResultCategory, ProcessError::EnvironmentCapacityExceeded)); |
| 217 | SC_TEST_EXPECT(environmentStringsArena.appendAsSingleString(first).isError( |
| 218 | ProcessResultCategory, ProcessError::EnvironmentCapacityExceeded)); |
| 219 | } |
| 220 | |
| 221 | #if !SC_PLATFORM_WINDOWS |
| 222 | StringSpan arguments[65] = {}; |
| 223 | const ResultProcess argumentCapacity = Process().launch({arguments, 65}); |
| 224 | SC_TEST_EXPECT(argumentCapacity.isError(ProcessError::ArgumentCapacityExceeded)); |
| 225 | #endif |
| 226 | |
| 227 | ResultErrorFormat formatted = formatProcessError(ProcessError::LaunchFailed, {}); |
| 228 | SC_TEST_EXPECT(formatted.status == ResultErrorFormatStatus::InsufficientCapacity); |
| 229 | SC_TEST_EXPECT(formatted.requiredCapacity > 1 and formatted.requiredCapacity <= 64); |
| 230 | |
| 231 | char exact[64]; |