test: validate executable knowledge syntax across libraries
This commit is contained in:
1 parent
b624084745
commit
fc7097bae4
11 files changed
+307
-17
No files matched your search
@@ -22,8 +22,14 @@ import sys:lib/sys.mq.md
|
||||
**task = > json.get value=`paths` key="task"**
|
||||
**skill = > json.get value=`paths` key="skill"**
|
||||
|
||||
> fs.remove_tree path=`mem`
|
||||
> fs.remove_tree path=`kb`
|
||||
1. > fs.exists path=`mem`
|
||||
> fs.remove_tree path=`mem`
|
||||
2. *
|
||||
**_ = 1**
|
||||
1. > fs.exists path=`kb`
|
||||
> fs.remove_tree path=`kb`
|
||||
2. *
|
||||
**_ = 1**
|
||||
> agent_memory_ensure memory_dir=`mem`
|
||||
|
||||
**ep1 = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" skill=`skill` llm_calls=2 memory_dir=`mem`**
|
||||
|
||||
@@ -22,8 +22,14 @@ import sys:lib/sys.mq.md
|
||||
**kb = > json.get value=`paths` key="kb"**
|
||||
**task = > json.get value=`paths` key="task"**
|
||||
|
||||
> fs.remove_tree path=`mem`
|
||||
> fs.remove_tree path=`kb`
|
||||
1. > fs.exists path=`mem`
|
||||
> fs.remove_tree path=`mem`
|
||||
2. *
|
||||
**_ = 1**
|
||||
1. > fs.exists path=`kb`
|
||||
> fs.remove_tree path=`kb`
|
||||
2. *
|
||||
**_ = 1**
|
||||
> agent_memory_ensure memory_dir=`mem`
|
||||
|
||||
**ep1 = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" llm_calls=2 memory_dir=`mem`**
|
||||
|
||||
@@ -24,7 +24,7 @@ H-Z-H on |0⟩ → |1⟩.
|
||||
|
||||
Ry(π) on |0⟩ → |1⟩.
|
||||
|
||||
**pi = > math.pi**
|
||||
**pi = math.pi**
|
||||
**ry = > quantum.circuit qubits=1**
|
||||
**ry = > `ry`.ry qubit=0 theta=`pi`**
|
||||
**rp = > `ry`.probabilities**
|
||||
|
||||
@@ -504,6 +504,56 @@ fn bytecode_ns_associated_function() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn structure_new_path_stdlib() {
|
||||
assert_out(
|
||||
"tests/structure/new-path-stdlib.mq.md",
|
||||
"3.1415926536",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bytecode_new_path_stdlib() {
|
||||
assert_out_backend(
|
||||
"tests/structure/new-path-stdlib.mq.md",
|
||||
"bytecode",
|
||||
"3.1415926536",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn knowledge_resolve_new_path() {
|
||||
let (code, stdout, stderr) = run(&[
|
||||
"knowledge",
|
||||
"tests/structure/ns",
|
||||
"--json",
|
||||
"resolve",
|
||||
"helpers.Box.birth_year",
|
||||
"--from",
|
||||
"tests/structure/ns/associated.mq.md",
|
||||
]);
|
||||
assert_eq!(code, 0, "{stderr}");
|
||||
let value: serde_json::Value = serde_json::from_str(&stdout).unwrap();
|
||||
assert_eq!(value["resolution"], "symbol");
|
||||
assert_eq!(value["symbol"]["callable"], "associated_function");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn knowledge_resolve_rejects_instance_path() {
|
||||
let (code, stdout, stderr) = run(&[
|
||||
"knowledge",
|
||||
"tests/structure/ns",
|
||||
"--json",
|
||||
"resolve",
|
||||
"helpers.Box.type_name",
|
||||
"--from",
|
||||
"tests/structure/ns/associated.mq.md",
|
||||
]);
|
||||
assert_eq!(code, 1, "{stderr}");
|
||||
let value: serde_json::Value = serde_json::from_str(&stdout).unwrap();
|
||||
assert_eq!(value["resolution"], "instance_only");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_ns_instance_method() {
|
||||
assert_err(
|
||||
@@ -2046,6 +2096,13 @@ fn ext_web_cache_artifact_smoke() {
|
||||
|
||||
#[test]
|
||||
fn ext_web_artifact_endpoint_live() {
|
||||
// Restricted CI/sandbox runners may disallow every listening socket. The
|
||||
// static/artifact tests still exercise the feature there; this one only
|
||||
// verifies the live HTTP boundary when the OS grants that capability.
|
||||
if std::net::TcpListener::bind("127.0.0.1:0").is_err() {
|
||||
eprintln!("skip ext_web_artifact_endpoint_live: local sockets are unavailable");
|
||||
return;
|
||||
}
|
||||
ensure_web_plugin_built();
|
||||
let bin = env!("CARGO_BIN_EXE_marqdo");
|
||||
let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
|
||||
@@ -15,7 +15,7 @@ import re:lib/re.mq.md
|
||||
|
||||
> log.debug text="shown-debug"
|
||||
|
||||
**id = > uuid.v4**
|
||||
**id = uuid.v4**
|
||||
**n = > len `id`**
|
||||
> print text=`n`
|
||||
**ok = > re.is_match text=`id` pattern="^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"**
|
||||
|
||||
@@ -5,7 +5,7 @@ title: math num + zh
|
||||
|
||||
# main
|
||||
|
||||
**p = > 数学.圆周率**
|
||||
**p = 数学.圆周率**
|
||||
|
||||
**t = > type `p`**
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: zero-argument standard-library knowledge in a value position
|
||||
import math:lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**pi = math.pi**
|
||||
|
||||
> print text=`pi`
|
||||
Reference in new issue
Block a user