Files
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

35 lines
2.7 KiB
Plaintext

pub fn main(world: World) -> Void raises {
var arena_buf: [16]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var arena: FixedBufAlloc = std.mem.fixedBufAlloc(arena_buf)
let parsed: Maybe<JsonDoc> = std.json.parse(arena, "{\"ok\":true}")
let input: Span<u8> = "{\"name\":\"zero\",\"count\":42,\"ok\":true}"
var name_buf: [8]u8 = [0; 8]
let name: Maybe<Span<u8>> = std.json.string(name_buf, input, "name")
let count: Maybe<u32> = std.json.u32(input, "count")
let ok: Maybe<Bool> = std.json.bool(input, "ok")
var json_buf: [16]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let json_text: Maybe<String> = std.json.writeString(json_buf, "zero")
var json_obj_buf: [24]u8 = [0; 24]
let json_obj: Maybe<Span<u8>> = std.json.writeObject1U32(json_obj_buf, "count", 42)
var hex_buf: [16]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let hex: Maybe<String> = std.codec.hexEncode(hex_buf, std.mem.span("Az"))
var hex_decode_buf: [2]u8 = [0; 2]
let hex_decoded: Maybe<Span<u8>> = std.codec.hexDecode(hex_decode_buf, "417a")
var b64_buf: [16]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let b64: Maybe<String> = std.codec.base64Encode(b64_buf, std.mem.span("abc"))
var b64_decode_buf: [3]u8 = [0; 3]
let b64_decoded: Maybe<Span<u8>> = std.codec.base64Decode(b64_decode_buf, "YWJj")
var url_buf: [24]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let url: Maybe<String> = std.codec.urlEncode(url_buf, "a b")
var query_buf: [16]u8 = [0; 16]
let query_part: Maybe<Span<u8>> = std.url.writeQueryParam(query_buf, "q", "zero lang")
var full_url_buf: [48]u8 = [0; 48]
var full_url: Maybe<Span<u8>> = null
if query_part.has {
full_url = std.url.appendQuery(full_url_buf, "https://example.com/search", query_part.value)
}
if std.json.validate("{\"ok\":true}") && parsed.has && std.json.streamTokens("{\"ok\":true}") == 3 && json_text.has && std.mem.eql(json_text.value, "\"zero\"") && name.has && std.mem.eql(name.value, "zero") && count.has && count.value == 42 && ok.has && ok.value && json_obj.has && std.mem.eql(json_obj.value, "{\"count\":42}") && std.codec.base64EncodedLen(3) == 4 && b64.has && std.mem.eql(b64.value, "YWJj") && b64_decoded.has && std.mem.eql(b64_decoded.value, "abc") && hex.has && std.mem.eql(hex.value, "417a") && hex_decoded.has && std.mem.eql(hex_decoded.value, "Az") && std.codec.utf8Valid(std.mem.span("ascii")) && url.has && std.mem.eql(url.value, "a%20b") && query_part.has && full_url.has && std.mem.eql(full_url.value, "https://example.com/search?q=zero+lang") && std.mem.eql(std.json.decodeBoundary(), "typed-decode-explicit-shape") {
check world.out.write("std data formats ok\n")
}
}