-- DreamStack Language Features Test -- Exercises all core language features in one place -- Tests: operators, assignment ops, array methods, computed signals, -- when/else, match, each, method calls, string interpolation import { Card } from "../registry/components/card" import { Badge } from "../registry/components/badge" import { Button } from "../registry/components/button" -- State let count = 10 let items = ["Alpha", "Beta", "Gamma"] let loggedIn = false let mode = "normal" -- Computed signals (derived) let doubled = count * 2 let isHigh = count > 50 view test = column [ text "๐Ÿงช Language Features" { variant: "title" } text "Testing all operators and methods" { variant: "subtitle" } -- 1. All assignment operators: +=, -=, *=, /= Card { title: "Assignment Operators", subtitle: "+= -= *= /=" } [ text "count: {count} | doubled: {doubled}" { variant: "title" } row [ Button { label: "+5", variant: "primary", onClick: count += 5 } Button { label: "-3", variant: "secondary", onClick: count -= 3 } Button { label: "ร—2", variant: "primary", onClick: count *= 2 } Button { label: "รท2", variant: "secondary", onClick: count /= 2 } Button { label: "=1", variant: "ghost", onClick: count = 1 } ] ] -- 2. Boolean operators && || ! Card { title: "Boolean Logic", subtitle: "&& || ! operators" } [ Button { label: "Toggle Login", variant: "primary", onClick: loggedIn = !loggedIn } when loggedIn -> Badge { label: "Logged In โœ“", variant: "success" } else -> Badge { label: "Logged Out", variant: "error" } ] -- 3. Array methods: push, pop, clear, sort, reverse Card { title: "Array Methods", subtitle: "push pop clear sort reverse" } [ text "Items: {items}" { variant: "title" } text "{items}" { variant: "subtitle" } row [ Button { label: "Push", variant: "primary", onClick: items.push("New") } Button { label: "Pop", variant: "secondary", onClick: items.pop() } Button { label: "Sort", variant: "ghost", onClick: items.sort() } Button { label: "Reverse", variant: "ghost", onClick: items.reverse() } Button { label: "Clear", variant: "destructive", onClick: items.clear() } ] each item in items -> row [ text "โ†’" text item ] ] -- 4. Match expressions Card { title: "Pattern Matching", subtitle: "match with fall-through" } [ row [ Button { label: "Normal", variant: "secondary", onClick: mode = "normal" } Button { label: "Turbo", variant: "primary", onClick: mode = "turbo" } Button { label: "Zen", variant: "ghost", onClick: mode = "zen" } ] match mode "turbo" -> Badge { label: "๐Ÿ”ฅ TURBO", variant: "warning" } "zen" -> Badge { label: "๐Ÿง˜ ZEN", variant: "info" } _ -> Badge { label: "๐Ÿ“ Normal", variant: "default" } ] -- 5. Comparison operators Card { title: "Comparisons", subtitle: "> < >= <= == !=" } [ text "count = {count}" when count > 50 -> Badge { label: "HIGH (>50)", variant: "warning" } when count > 20 -> Badge { label: "MEDIUM (>20)", variant: "info" } else -> Badge { label: "LOW (โ‰ค20)", variant: "success" } ] ]