feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules

Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
This commit is contained in:
2026-01-24 22:40:22 +00:00
parent 0a65272f80
commit 5a4054ec66
105 changed files with 23275 additions and 94 deletions
+69
View File
@@ -0,0 +1,69 @@
// retoor <retoor@molodetz.nl>
import "websocket" for WebSocket, WebSocketServer
import "scheduler" for Scheduler
import "timer" for Timer
var port = 19877
var payloadSize = 3 * 1024 * 1024
var result = "pending"
Scheduler.add {
var server = WebSocketServer.bind("127.0.0.1", port)
var ws = server.accept()
if (ws != null) {
var msg = ws.receive()
if (msg != null && msg.isBinary) {
ws.sendBinary(msg.bytes)
}
ws.close()
}
server.close()
}
Timer.sleep(50)
Scheduler.add {
var ws = WebSocket.connect("ws://127.0.0.1:%(port)")
var payload = []
var i = 0
while (i < payloadSize) {
payload.add(i % 256)
i = i + 1
}
ws.sendBinary(payload)
var response = ws.receive()
if (response == null) {
result = "error: no response"
} else if (!response.isBinary) {
result = "error: not binary"
} else if (response.bytes.count != payloadSize) {
result = "error: size mismatch %(response.bytes.count) != %(payloadSize)"
} else {
var mismatch = false
i = 0
while (i < payloadSize) {
if (response.bytes[i] != (i % 256)) {
mismatch = true
break
}
i = i + 1
}
if (mismatch) {
result = "error: data mismatch at %(i)"
} else {
result = "ok"
}
}
ws.close()
}
Timer.sleep(30000)
System.print(result) // expect: ok