Terrace/test/comprehensive.test.tce
Joshua Bemenderfer 9d9757e868 Updates.
2025-09-08 16:24:38 -04:00

183 lines
5.5 KiB
Plaintext

#schema test
describe New API Basic Tests
it Parses simple hierarchical structure
key new-api:basic
input
title My Document
description
This is a description
With multiple lines
section Getting Started
step Install the package
step Run the tests
output
| level 0 | head "title" | tail "My Document" | content "title My Document" |
| level 0 | head "description" | tail "" | content "description" |
| level 1 | head "This" | tail "is a description" | content "This is a description" |
| level 1 | head "With" | tail "multiple lines" | content "With multiple lines" |
| level 0 | head "section" | tail "Getting Started" | content "section Getting Started" |
| level 1 | head "step" | tail "Install the package" | content "step Install the package" |
| level 1 | head "step" | tail "Run the tests" | content "step Run the tests" |
it Handles empty lines and whitespace
key new-api:empty-lines
input
item1 value1
item2 value2
nested under item2
output
| level 0 | head "item1" | tail "value1" | content "item1 value1" |
| level 0 | head "item2" | tail "value2" | content "item2 value2" |
| level 1 | head "nested" | tail "under item2" | content "nested under item2" |
it Parses complex nested structures
key new-api:hierarchical
input
config
database
host localhost
port 5432
server
port 3000
host 0.0.0.0
feature_flags
debug true
logging false
output
| level 0 | head "config" | tail "" | content "config" |
| level 1 | head "database" | tail "" | content "database" |
| level 2 | head "host" | tail "localhost" | content "host localhost" |
| level 2 | head "port" | tail "5432" | content "port 5432" |
| level 1 | head "server" | tail "" | content "server" |
| level 2 | head "port" | tail "3000" | content "port 3000" |
| level 2 | head "host" | tail "0.0.0.0" | content "host 0.0.0.0" |
| level 0 | head "feature_flags" | tail "" | content "feature_flags" |
| level 1 | head "debug" | tail "true" | content "debug true" |
| level 1 | head "logging" | tail "false" | content "logging false" |
describe Node Methods Tests
it Tests node properties and methods
key new-api:node-methods
input
title Test Document
empty_line
regular_line With some content
multi word content
output
Node: head="title", tail="Test Document", isEmpty=false, is(title)=true
content="title Test Document", raw(0)="title Test Document", lineNumber=1
Node: head="empty_line", tail="", isEmpty=true, is(title)=false
content="empty_line", raw(0)="empty_line", lineNumber=2
Node: head="regular_line", tail="With some content", isEmpty=false, is(title)=false
content="regular_line With some content", raw(0)="regular_line With some content", lineNumber=4
Node: head="multi", tail="word content", isEmpty=false, is(title)=false
content="multi word content", raw(0)="multi word content", lineNumber=5
describe Functional API Tests
it Tests filtering and finding nodes
key new-api:functional
input
config
database
host localhost
port 5432
name myapp
server
port 3000
host 0.0.0.0
feature_flags
debug true
logging false
output
Found 2 config sections
Found feature flags section
describe Inconsistent Indentation Tests
it Handles arbitrary nesting levels
key new-api:inconsistent-indentation
input
level1
level2
level5
level3
level6
level2
output
| level 0 | head "level1" | tail "" |
| level 1 | head "level2" | tail "" |
| level 4 | head "level5" | tail "" |
| level 2 | head "level3" | tail "" |
| level 5 | head "level6" | tail "" |
| level 1 | head "level2" | tail "" |
describe Reader Utilities Tests
it Tests different reader implementations
key new-api:readers
input
item1 value1
nested1 nested_value1
nested2 nested_value2
item2 value2
output
item1: value1
nested1: nested_value1
nested2: nested_value2
item2: value2
describe Node Methods Tests
it Tests node properties and methods
key new-api:node-methods
input
multi word content
output
describe Functional API Tests
it Tests filtering and finding nodes
key new-api:functional
input
config
database
host localhost
port 5432
server
port 3000
host 0.0.0.0
feature_flags
enable_new_ui true
enable_beta_features false
output
Found feature flags section
Found 2 config sections
describe Legacy Compatibility Tests
it Tests legacy API compatibility
key new-api:legacy-compat
input
config
database localhost
server 3000
feature_flags
debug true
output
Found config section using legacy API
Config item: head starts with 'd', tail='localhost'
Config item: head starts with 's', tail='3000'
describe Content Method Tests
it Content method uses offsetHead correctly
key new-api:content-method
input
title My Document Title
section Introduction
paragraph This is a paragraph with content
code
console.log("Hello World")
output
| level 0 | head "title" | tail "My Document Title" | content "title My Document Title" |
| level 0 | head "section" | tail "Introduction" | content "section Introduction" |
| level 1 | head "paragraph" | tail "This is a paragraph with content" | content "paragraph This is a paragraph with content" |
| level 1 | head "code" | tail "" | content "code" |
| level 2 | head "console.log("Hello" | tail "World")" | content "console.log("Hello World")" |