feat: add buildmanual target, faker demo, subprocess examples, and contributing sidebar to manual

Add Makefile buildmanual target for manual generation and include faker_demo.wren, subprocess_async_demo.wren, subprocess_concurrent_demo.wren, and subprocess_fiber_demo.wren example scripts. Update manual sidebar across api pages to link new web-server tutorial and contributing section with module architecture, pure-wren/c-backed modules, foreign classes, async patterns, testing, and documentation pages.
This commit is contained in:
2026-01-25 18:02:02 +00:00
parent 819bbd5091
commit 5c2269f6a7
92 changed files with 10955 additions and 621 deletions
+63
View File
@@ -0,0 +1,63 @@
// retoor <retoor@molodetz.nl>
import "faker" for Faker
var name = Faker.name()
System.print(name.contains(" ")) // expect: true
var email = Faker.email()
System.print(email.contains("@")) // expect: true
var firstName = Faker.firstName()
System.print(firstName.count > 0) // expect: true
var lastName = Faker.lastName()
System.print(lastName.count > 0) // expect: true
var city = Faker.city()
System.print(city.count > 0) // expect: true
var address = Faker.address()
System.print(address.contains(",")) // expect: true
var ipv4 = Faker.ipv4()
System.print(ipv4.contains(".")) // expect: true
var uuid = Faker.uuid()
System.print(uuid.count == 36) // expect: true
var phone = Faker.phoneNumber()
System.print(phone.contains("(")) // expect: true
var company = Faker.company()
System.print(company.count > 0) // expect: true
var job = Faker.jobTitle()
System.print(job.count > 0) // expect: true
var word = Faker.word()
System.print(word.count > 0) // expect: true
var sentence = Faker.sentence()
System.print(sentence.endsWith(".")) // expect: true
var hexColor = Faker.hexColor()
System.print(hexColor.startsWith("#")) // expect: true
System.print(hexColor.count == 7) // expect: true
var price = Faker.price()
System.print(price >= 1) // expect: true
System.print(price <= 1000) // expect: true
var bool1 = Faker.boolean()
System.print(bool1 is Bool) // expect: true
var digits = Faker.numerify("###-##-####")
System.print(digits.count == 11) // expect: true
System.print(digits[3] == "-") // expect: true
var letters = Faker.letterify("???-???")
System.print(letters.count == 7) // expect: true
System.print(letters[3] == "-") // expect: true
System.print("All basic tests passed") // expect: All basic tests passed
+28
View File
@@ -0,0 +1,28 @@
// retoor <retoor@molodetz.nl>
import "faker" for Faker
Faker.seed(12345)
var name1 = Faker.name()
var email1 = Faker.email()
var city1 = Faker.city()
var int1 = Faker.randomInt(1, 100)
Faker.seed(12345)
var name2 = Faker.name()
var email2 = Faker.email()
var city2 = Faker.city()
var int2 = Faker.randomInt(1, 100)
System.print(name1 == name2) // expect: true
System.print(email1 == email2) // expect: true
System.print(city1 == city2) // expect: true
System.print(int1 == int2) // expect: true
Faker.seed(99999)
var name3 = Faker.name()
System.print(name1 != name3) // expect: true
Faker.reset()
System.print("Seeding tests passed") // expect: Seeding tests passed
+16
View File
@@ -0,0 +1,16 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
var p1 = Popen.new(["echo", "test"])
System.print(p1.pid > 0) // expect: true
var out1 = p1.stdout.read()
System.print(out1.trim()) // expect: test
System.print(p1.wait()) // expect: 0
var p2 = Popen.new(["cat"])
p2.stdin.write("hello")
p2.stdin.close()
var out2 = p2.stdout.read()
System.print(out2) // expect: hello
System.print(p2.wait()) // expect: 0
+9
View File
@@ -0,0 +1,9 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
var p = Popen.new(["echo", "hello"])
var output = p.stdout.read()
System.print(output.trim()) // expect: hello
var code = p.wait()
System.print(code) // expect: 0
+11
View File
@@ -0,0 +1,11 @@
// retoor <retoor@molodetz.nl>
import "subprocess" for Popen
var p = Popen.new(["sh"], true)
System.print(p.pid > 0) // expect: true
p.stdin.write("echo pty_test\n")
p.stdin.write("exit\n")
var out = p.stdout.read()
System.print(out.contains("pty_test")) // expect: true
System.print(p.wait()) // expect: 0
+25
View File
@@ -0,0 +1,25 @@
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
var items = ["a", "b", "c"]
var futures = []
for (item in items) {
futures.add(async { "processed_" + item })
}
System.print(futures.count) // expect: 3
System.print(futures[0] is Future) // expect: true
System.print(futures[1] is Future) // expect: true
System.print(futures[2] is Future) // expect: true
var results = []
for (f in futures) {
results.add(await f)
}
System.print(results.count) // expect: 3
System.print(results[0]) // expect: processed_a
System.print(results[1]) // expect: processed_b
System.print(results[2]) // expect: processed_c
+24
View File
@@ -0,0 +1,24 @@
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
System.print("Creating futures") // expect: Creating futures
var future1 = async { {"url": "url1", "status": 200} }
var future2 = async { {"url": "url2", "status": 201} }
var future3 = async { {"url": "url3", "status": 202} }
System.print(future1 is Future) // expect: true
System.print(future2 is Future) // expect: true
System.print(future3 is Future) // expect: true
var result1 = await future1
var result2 = await future2
var result3 = await future3
System.print(result1["url"]) // expect: url1
System.print(result1["status"]) // expect: 200
System.print(result2["url"]) // expect: url2
System.print(result2["status"]) // expect: 201
System.print(result3["url"]) // expect: url3
System.print(result3["status"]) // expect: 202
+13
View File
@@ -0,0 +1,13 @@
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
var future = async { 42 }
System.print(future is Future) // expect: true
var result = await future
System.print(result) // expect: 42
System.print(future.isDone) // expect: true
System.print(future.result) // expect: 42
+12
View File
@@ -0,0 +1,12 @@
// retoor <retoor@molodetz.nl>
import "web" for WebSocketResponse
var ws = WebSocketResponse.new()
System.print(ws.isPrepared) // expect: false
System.print(ws.isOpen) // expect: false
var ws2 = WebSocketResponse.new()
System.print(ws2 is WebSocketResponse) // expect: true
System.print(ws2.isPrepared == false) // expect: true
System.print(ws2.isOpen == false) // expect: true