// app/capi_test.prg — verifies bridge_capi RTL in isolation // (single thread, no HTTP). Multi-thread isolation will be exercised // once the dispatcher is wired in 1a.3-3. FUNCTION Main() LOCAL cJson, cOut, cResult ? "=== _CTX_SET_JSON / _CTX_GET_JSON ===" _CTX_SET_JSON( '{"user":"alice","role":"admin"}' ) cJson := _CTX_GET_JSON() ? "ctx json:", cJson ? "ctx_get user:", ctx_get( "user", "?" ) ? "ctx_get role:", ctx_get( "role", "?" ) ? "ctx_get missing:", ctx_get( "nope", "DEFAULT" ) ? "" ? "=== _OUT_APPEND / _OUT_GET / _OUT_CLEAR ===" _OUT_APPEND( "Hello, " ) _OUT_APPEND( "world! " ) _OUT_APPEND( "Three." ) cOut := _OUT_GET() ? "out before clear: [" + cOut + "]" _OUT_CLEAR() ? "out after clear: [" + _OUT_GET() + "]" ? "" ? "=== _BRIDGE_SET_RESULT / _BRIDGE_GET_RESULT ===" _BRIDGE_SET_RESULT( "fast-path payload" ) cResult := _BRIDGE_GET_RESULT() ? "result:", cResult RETURN NIL