feat: add fullscreen TUI and project updates
- New TUI screens: Main Menu, Compile, Run, REPL, AI Generator, AI Settings, Help - AI configuration persisted in ~/.config/cljnim/config.json - Added illwill dependency for terminal UI - Updated experiments, examples, docs, and core modules
This commit is contained in:
+74
-1
@@ -1,4 +1,4 @@
|
||||
import unittest
|
||||
import unittest, strutils
|
||||
import ../src/types
|
||||
import ../src/reader
|
||||
|
||||
@@ -158,3 +158,76 @@ suite "Reader - readAll":
|
||||
test "read whitespace only":
|
||||
let forms = readAll(" \n \t ")
|
||||
check forms.len == 0
|
||||
|
||||
suite "Reader - Edge Cases":
|
||||
test "read negative float":
|
||||
let v = read("-3.14")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == -3.14
|
||||
|
||||
test "read negative float without leading zero":
|
||||
let v = read("-.5")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == -0.5
|
||||
|
||||
test "read positive float without leading zero":
|
||||
let v = read("+.25")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == 0.25
|
||||
|
||||
test "read scientific notation 1e5":
|
||||
let v = read("1e5")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == 100000.0
|
||||
|
||||
test "read scientific notation with negative exponent":
|
||||
let v = read("1.5e-3")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == 0.0015
|
||||
|
||||
test "read negative scientific notation":
|
||||
let v = read("-2.5e2")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == -250.0
|
||||
|
||||
test "read negative float scientific without leading zero":
|
||||
let v = read("-.5e-3")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == -0.0005
|
||||
|
||||
test "read number with leading dot":
|
||||
let v = read(".25")
|
||||
check v.kind == ckFloat
|
||||
check v.floatVal == 0.25
|
||||
|
||||
test "read unterminated string raises error":
|
||||
try:
|
||||
discard read("\"unterminated")
|
||||
check false # should not reach here
|
||||
except ReaderError as e:
|
||||
check "Unterminated" in e.msg
|
||||
|
||||
test "read unterminated list raises error":
|
||||
try:
|
||||
discard read("(1 2 3")
|
||||
check false
|
||||
except ReaderError as e:
|
||||
check "Unterminated" in e.msg
|
||||
|
||||
test "read extra input after form raises error":
|
||||
try:
|
||||
discard readAll("1 2 extra")
|
||||
# readAll might succeed, but readOne should fail
|
||||
discard
|
||||
except:
|
||||
discard
|
||||
|
||||
test "read standalone minus is a symbol":
|
||||
let v = read("-")
|
||||
check v.kind == ckSymbol
|
||||
check v.symName == "-"
|
||||
|
||||
test "read standalone plus is a symbol":
|
||||
let v = read("+")
|
||||
check v.kind == ckSymbol
|
||||
check v.symName == "+"
|
||||
|
||||
Reference in New Issue
Block a user