Initial vibecoded proof of concept
This commit is contained in:
parent
74812459af
commit
461318a656
61 changed files with 13306 additions and 0 deletions
32
tests/spec/document_spec.lua
Normal file
32
tests/spec/document_spec.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
-- tests/spec/document_spec.lua
|
||||
local document = require("notex.document")
|
||||
|
||||
describe("Document Parsing", function()
|
||||
it("should parse a markdown file with YAML frontmatter", function()
|
||||
local file_content = [[
|
||||
---
|
||||
type: person
|
||||
name: John Doe
|
||||
email: john.doe@example.com
|
||||
---
|
||||
|
||||
# John Doe
|
||||
|
||||
This is a document about John Doe.
|
||||
]]
|
||||
|
||||
local doc = document.parse(file_content)
|
||||
|
||||
print("doc.type: " .. doc.type)
|
||||
for k, v in pairs(doc.properties) do
|
||||
print("doc.properties[" .. k .. "]: " .. tostring(v))
|
||||
end
|
||||
print("doc.content: " .. doc.content)
|
||||
|
||||
assert.are.same("person", doc.type)
|
||||
assert.are.same("John Doe", doc.properties.name)
|
||||
assert.are.same("john.doe@example.com", doc.properties.email)
|
||||
assert.are.same("# John Doe\n\nThis is a document about John Doe.\n", doc.content)
|
||||
end)
|
||||
end)
|
||||
|
0
tests/spec/query_spec.lua
Normal file
0
tests/spec/query_spec.lua
Normal file
23
tests/spec/schema_spec.lua
Normal file
23
tests/spec/schema_spec.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- tests/spec/schema_spec.lua
|
||||
local schema = require("notex.schema")
|
||||
|
||||
describe("Schema Inference", function()
|
||||
it("should infer schema from a document", function()
|
||||
local doc = {
|
||||
type = "person",
|
||||
properties = {
|
||||
name = "John Doe",
|
||||
age = 30,
|
||||
is_student = false,
|
||||
},
|
||||
}
|
||||
|
||||
local inferred_schema = schema.infer(doc)
|
||||
|
||||
assert.are.same({
|
||||
name = "string",
|
||||
age = "number",
|
||||
is_student = "boolean",
|
||||
}, inferred_schema)
|
||||
end)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue