dirac-lang 0.1.24 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/cli.js +13 -1
  2. package/lib/index.di +9 -0
  3. package/{examples/lib → lib}/math.di +3 -3
  4. package/package.json +13 -1
  5. package/.env.example +0 -8
  6. package/COMMUNITY.md +0 -465
  7. package/CONDITIONAL-TAGS.md +0 -172
  8. package/EXCEPTION-HANDLING.md +0 -156
  9. package/LIBRARIES.md +0 -172
  10. package/LLM-VALIDATION.md +0 -128
  11. package/NAMESPACES.md +0 -366
  12. package/PROMOTION.md +0 -257
  13. package/QUICKSTART-LIBRARY.md +0 -93
  14. package/TEST-COVERAGE.md +0 -113
  15. package/TESTING.md +0 -162
  16. package/config.test.yml +0 -5
  17. package/dirac-http/examples/demo.di +0 -9
  18. package/dirac-http/lib/index.di +0 -12
  19. package/examples/add-demo.di +0 -74
  20. package/examples/add.bk +0 -11
  21. package/examples/advanced-math-demo.di +0 -53
  22. package/examples/calculator.di +0 -32
  23. package/examples/compact-test.di +0 -6
  24. package/examples/comprehensive.bk +0 -29
  25. package/examples/defvar-variable-demo.di +0 -18
  26. package/examples/direct-call.di +0 -17
  27. package/examples/disk-analysis.di +0 -16
  28. package/examples/exception-demo.di +0 -82
  29. package/examples/executable-hello.di +0 -7
  30. package/examples/execute-demo.di +0 -38
  31. package/examples/file-manager.di +0 -77
  32. package/examples/file-stats.di +0 -18
  33. package/examples/hello.bk +0 -1
  34. package/examples/hello.di +0 -5
  35. package/examples/if-comparison.di +0 -91
  36. package/examples/if-cstyle-test.di +0 -149
  37. package/examples/if-vs-testif.di +0 -56
  38. package/examples/import-demo.di +0 -31
  39. package/examples/inline-test.bk +0 -7
  40. package/examples/llm-agent.di +0 -32
  41. package/examples/llm-basic.di +0 -12
  42. package/examples/llm-command-more.di +0 -6
  43. package/examples/llm-command-no-exec.di +0 -13
  44. package/examples/llm-command.di +0 -6
  45. package/examples/llm-complex.di +0 -141
  46. package/examples/llm-feedback-debug.di +0 -30
  47. package/examples/llm-feedback-demo.di +0 -19
  48. package/examples/llm-feedback-math.di +0 -22
  49. package/examples/llm-feedback-simple.di +0 -16
  50. package/examples/llm-feedback-sub.di +0 -22
  51. package/examples/llm-no-feedback.di +0 -10
  52. package/examples/llm-recursive.di +0 -31
  53. package/examples/llm-reflection-test.di +0 -19
  54. package/examples/llm-simple-test.di +0 -12
  55. package/examples/llm-subs.di +0 -132
  56. package/examples/llm-use-subs.di +0 -6
  57. package/examples/llm-validate-test.di +0 -18
  58. package/examples/loop.di +0 -12
  59. package/examples/math-test.di +0 -22
  60. package/examples/minimal-test.di +0 -13
  61. package/examples/mongodb-context-test.di +0 -27
  62. package/examples/mongodb-count-events.di +0 -8
  63. package/examples/mongodb-import-demo.di +0 -25
  64. package/examples/mongodb-simple-test.di +0 -18
  65. package/examples/nl-agent.di +0 -47
  66. package/examples/parameters-demo.di +0 -68
  67. package/examples/params-meta-test.di +0 -17
  68. package/examples/params-test.di +0 -10
  69. package/examples/recipe-chain.di +0 -38
  70. package/examples/recursive-llm.di +0 -44
  71. package/examples/sample-library/README.md +0 -152
  72. package/examples/sample-library/examples/demo.di +0 -34
  73. package/examples/sample-library/lib/index.di +0 -65
  74. package/examples/sample-library/package.json +0 -31
  75. package/examples/scope-test-nested.di +0 -60
  76. package/examples/scope-test.di +0 -55
  77. package/examples/seamless.di +0 -45
  78. package/examples/shell-test.bk +0 -10
  79. package/examples/simple-import.di +0 -13
  80. package/examples/simple-recursive.di +0 -26
  81. package/examples/story-builder.di +0 -45
  82. package/examples/subroutine.di +0 -23
  83. package/examples/system-llm.di +0 -21
  84. package/examples/system-simple.di +0 -3
  85. package/examples/system-test.di +0 -8
  86. package/examples/tag-check-test.di +0 -139
  87. package/examples/task-assistant.di +0 -27
  88. package/examples/test-if-demo.di +0 -110
  89. package/examples/test-parameters.di +0 -50
  90. package/examples/try-catch-test.di +0 -118
  91. package/examples/two-styles.di +0 -28
  92. package/examples/var-debug.di +0 -6
  93. package/examples/var-inline.di +0 -4
  94. package/examples/var-test2.di +0 -6
  95. package/examples/variable-replace.di +0 -25
  96. package/examples/variable-simple.di +0 -16
  97. package/examples/variable-test.di +0 -22
  98. package/examples/whitespace-test.di +0 -24
  99. package/filePath +0 -1
  100. package/greeting.txt +0 -1
  101. package/src/cli.ts +0 -140
  102. package/src/index.ts +0 -33
  103. package/src/llm/ollama.ts +0 -58
  104. package/src/runtime/braket-parser.ts +0 -234
  105. package/src/runtime/interpreter.ts +0 -203
  106. package/src/runtime/parser.ts +0 -155
  107. package/src/runtime/session.ts +0 -325
  108. package/src/tags/assign.ts +0 -37
  109. package/src/tags/attr.ts +0 -64
  110. package/src/tags/available-subroutines.ts +0 -70
  111. package/src/tags/call.ts +0 -259
  112. package/src/tags/catch.ts +0 -24
  113. package/src/tags/defvar.ts +0 -115
  114. package/src/tags/environment.ts +0 -21
  115. package/src/tags/eval.ts +0 -71
  116. package/src/tags/exception.ts +0 -20
  117. package/src/tags/execute.ts +0 -52
  118. package/src/tags/expr.ts +0 -128
  119. package/src/tags/foreach.ts +0 -170
  120. package/src/tags/if.ts +0 -191
  121. package/src/tags/import.ts +0 -135
  122. package/src/tags/index.ts +0 -41
  123. package/src/tags/input.ts +0 -182
  124. package/src/tags/llm.ts +0 -415
  125. package/src/tags/loop.ts +0 -43
  126. package/src/tags/mongodb.ts +0 -70
  127. package/src/tags/output.ts +0 -53
  128. package/src/tags/parameters.ts +0 -81
  129. package/src/tags/require_module.ts +0 -19
  130. package/src/tags/subroutine.ts +0 -75
  131. package/src/tags/system.ts +0 -93
  132. package/src/tags/tag-check.ts +0 -176
  133. package/src/tags/test-if.ts +0 -112
  134. package/src/tags/throw.ts +0 -26
  135. package/src/tags/try.ts +0 -19
  136. package/src/tags/variable.ts +0 -25
  137. package/src/test-runner.ts +0 -300
  138. package/src/types/index.ts +0 -128
  139. package/src/utils/llm-adapter.ts +0 -113
  140. package/src/utils/tag-validator.ts +0 -231
  141. package/test-available-extends.di +0 -28
  142. package/test-available-simple.di +0 -12
  143. package/test-available-subroutines.di +0 -16
  144. package/test-call.di +0 -9
  145. package/test-extend-basic.di +0 -17
  146. package/test-extend-chain.di +0 -26
  147. package/test-extend-debug.di +0 -17
  148. package/test-extend-debug2.di +0 -15
  149. package/test-extend-person.di +0 -17
  150. package/test-extend-simple.di +0 -11
  151. package/test-extend-zhi.di +0 -23
  152. package/test-extend.di +0 -19
  153. package/test-extend2.di +0 -26
  154. package/test-extend3-fixed.di +0 -23
  155. package/test-extend3-trouble.di +0 -23
  156. package/test-extend3.di +0 -21
  157. package/test-factorial.di +0 -19
  158. package/test-input-debug.di +0 -19
  159. package/test-nested-debug.di +0 -7
  160. package/test-nested-debug2.di +0 -8
  161. package/test-no-extend.di +0 -16
  162. package/test-simple-call.di +0 -7
  163. package/test-simple.di +0 -6
  164. package/tests/README.md +0 -69
  165. package/tests/assign-basic.test.di +0 -7
  166. package/tests/assign-from-eval.test.di +0 -7
  167. package/tests/available-subroutines-foreach.test.di +0 -32
  168. package/tests/basic-output.test.di +0 -5
  169. package/tests/call-basic.test.di +0 -11
  170. package/tests/call-with-output.test.di +0 -10
  171. package/tests/comments-before-content.test.di +0 -6
  172. package/tests/defvar-multiple.test.di +0 -8
  173. package/tests/environment-basic.test.di +0 -22
  174. package/tests/environment-nonexistent.test.di +0 -5
  175. package/tests/environment-with-defvar.test.di +0 -15
  176. package/tests/eval-basic.test.di +0 -6
  177. package/tests/eval-with-variables.test.di +0 -8
  178. package/tests/exception-basic.test.di +0 -10
  179. package/tests/expr-basic.test.di +0 -11
  180. package/tests/extend-basic.test.di +0 -19
  181. package/tests/extend-inheritance-chain.test.di +0 -26
  182. package/tests/extend-multiple-nested.test.di +0 -24
  183. package/tests/extend-self.test.di +0 -19
  184. package/tests/extend-with-parameters.test.di +0 -14
  185. package/tests/generate-dirac.test.di +0 -22
  186. package/tests/if-conditional.test.di +0 -17
  187. package/tests/if-else.test.di +0 -11
  188. package/tests/if-with-variables.test.di +0 -8
  189. package/tests/import-basic.test.di +0 -6
  190. package/tests/input-file-all.test.di +0 -5
  191. package/tests/input-file-line.test.di +0 -15
  192. package/tests/input-file-loop.test.di +0 -12
  193. package/tests/input-stdin-all.test.di +0 -8
  194. package/tests/input-stdin-all.txt +0 -1
  195. package/tests/llm-validate.test.di +0 -17
  196. package/tests/loop-basic.test.di +0 -9
  197. package/tests/loop-nested.test.di +0 -10
  198. package/tests/loop-with-eval.test.di +0 -8
  199. package/tests/no-root-element.test.di +0 -6
  200. package/tests/output-file.test.di +0 -19
  201. package/tests/output-multiple.test.di +0 -9
  202. package/tests/parameters-basic.test.di +0 -6
  203. package/tests/require-module-basic.test.di +0 -7
  204. package/tests/subroutine-basic.test.di +0 -9
  205. package/tests/subroutine-multiple-params.test.di +0 -10
  206. package/tests/subroutine-nested-calls.test.di +0 -32
  207. package/tests/subroutine-sequential-calls.test.di +0 -36
  208. package/tests/system-background.test.di +0 -39
  209. package/tests/system-basic.test.di +0 -5
  210. package/tests/tag-check.test.di +0 -27
  211. package/tests/test-if-basic.test.di +0 -8
  212. package/tests/test-input.txt +0 -3
  213. package/tests/try-catch-basic.test.di +0 -10
  214. package/tests/try-catch-eval-error.test.di +0 -10
  215. package/tests/variable-basic.test.di +0 -6
  216. package/tests/variable-interpolation.test.di +0 -7
  217. package/tools/create-library.sh +0 -175
  218. package/tsconfig.json +0 -19
  219. /package/{examples/lib → lib}/advanced-math.di +0 -0
  220. /package/{examples/lib → lib}/fileops.di +0 -0
  221. /package/{examples/lib → lib}/mongodb.di +0 -0
package/tests/README.md DELETED
@@ -1,69 +0,0 @@
1
- # Dirac Test Suite
2
-
3
- Comprehensive unit tests for all Dirac tags and features.
4
-
5
- ## Running Tests
6
-
7
- ```bash
8
- npm test
9
- ```
10
-
11
- ## Test Coverage
12
-
13
- ### Core Tags
14
- - ✅ `<output>` - Basic output, multiple outputs
15
- - ✅ `<defvar>` - Variable definition, multiple variables
16
- - ✅ `<variable>` - Variable interpolation
17
- - ✅ `<assign>` - Basic assignment, assignment from eval
18
- - ✅ `<eval>` - Basic eval, eval with variables
19
- - ✅ `<expr>` - Basic expressions, string concatenation
20
-
21
- ### Control Flow
22
- - ✅ `<if>` - Basic conditionals, with variables, else logic
23
- - ✅ `<loop>` - Basic loops, nested loops, loops with eval
24
-
25
- ### Functions
26
- - ✅ `<subroutine>` - Basic subroutines, multiple params, recursive
27
- - ✅ `<call>` - Basic calls, calls with output
28
- - ✅ `<import>` - Import external libraries
29
- - ✅ `<parameters>` - Parameter definitions with defaults
30
-
31
- ### System Integration
32
- - ✅ `<system>` - Basic system commands, output capture, trim
33
- - ✅ `<require_module>` - Node.js module imports
34
-
35
- ### Error Handling
36
- - ✅ `<try>` - Try blocks
37
- - ✅ `<catch>` - Catch blocks, error variable
38
- - ✅ `<throw>` - Throw custom errors
39
- - ✅ `<exception>` - Exception handling
40
-
41
- ### Advanced (Need manual testing with LLM)
42
- - ⚠️ `<llm>` - Requires LLM configuration
43
- - ⚠️ `<execute>` - Requires LLM configuration
44
- - ⚠️ `<mongodb>` - Requires MongoDB connection
45
-
46
- ## Test Format
47
-
48
- Each test file follows this format:
49
-
50
- ```xml
51
- <!-- TEST: test_name -->
52
- <!-- EXPECT: expected output -->
53
- <dirac>
54
- <!-- Test code here -->
55
- </dirac>
56
- ```
57
-
58
- ## Adding New Tests
59
-
60
- 1. Create a new `.test.di` file in `/tests`
61
- 2. Add TEST and EXPECT comments
62
- 3. Write your test
63
- 4. Run `npm test`
64
-
65
- ## Test Statistics
66
-
67
- - **Total Tests**: 32
68
- - **Tag Coverage**: 19/24 tags (79%)
69
- - **Missing Coverage**: llm, execute, mongodb (require external services)
@@ -1,7 +0,0 @@
1
- <!-- TEST: assign_basic -->
2
- <!-- EXPECT: New value: updated -->
3
- <dirac>
4
- <defvar name="myvar" value="initial" />
5
- <assign name="myvar" value="updated" />
6
- <output>New value: <variable name="myvar" /></output>
7
- </dirac>
@@ -1,7 +0,0 @@
1
- <!-- TEST: assign_from_eval -->
2
- <!-- EXPECT: Result: 15 -->
3
- <dirac>
4
- <defvar name="result" value="0" />
5
- <eval name="result">return 10 + 5;</eval>
6
- <output>Result: <variable name="result" /></output>
7
- </dirac>
@@ -1,32 +0,0 @@
1
- <!-- TEST: available-subroutines with foreach and attr -->
2
- <!-- EXPECT: - show-subroutines:
3
- - greet: Greets someone
4
- - gender: Returns gender identity
5
- - age: Returns the person age -->
6
- <dirac>
7
- <subroutine name="TestSuite">
8
- <subroutine name="age" description="Returns the person age">
9
- <output>42</output>
10
- </subroutine>
11
-
12
- <subroutine name="gender" description="Returns gender identity">
13
- <output>Male</output>
14
- </subroutine>
15
-
16
- <subroutine name="greet" description="Greets someone">
17
- <output>Hello!</output>
18
- </subroutine>
19
-
20
- <subroutine name="show-subroutines">
21
- <defvar name="subs"><available-subroutines /></defvar>
22
- <foreach from="$subs" as="sub" xpath="//subroutine">
23
- <output>- <attr name="name" from="$sub" />: <attr name="description" from="$sub" />
24
- </output>
25
- </foreach>
26
- </subroutine>
27
-
28
- <show-subroutines />
29
- </subroutine>
30
-
31
- <TestSuite />
32
- </dirac>
@@ -1,5 +0,0 @@
1
- <!-- TEST: basic_output -->
2
- <!-- EXPECT: Hello, World! -->
3
- <dirac>
4
- <output>Hello, World!</output>
5
- </dirac>
@@ -1,11 +0,0 @@
1
- <!-- TEST: call_basic -->
2
- <!-- EXPECT: Square of 5 is: 25 -->
3
- <dirac>
4
- <subroutine name="square" param-x="number">
5
- <eval name="result">return parseInt(x) * parseInt(x);</eval>
6
- <output><variable name="result" /></output>
7
- </subroutine>
8
-
9
- <output>Square of 5 is: </output>
10
- <call name="square" x="5" />
11
- </dirac>
@@ -1,10 +0,0 @@
1
- <!-- TEST: call_with_output -->
2
- <!-- EXPECT: 100 -->
3
- <dirac>
4
- <subroutine name="square" param-x="number">
5
- <eval name="result">return parseInt(x) * parseInt(x);</eval>
6
- <output><variable name="result" /></output>
7
- </subroutine>
8
-
9
- <call name="square" x="10" />
10
- </dirac>
@@ -1,6 +0,0 @@
1
- <!-- TEST: comments_before_content -->
2
- <!-- EXPECT: Success -->
3
- <!-- First comment -->
4
- <!-- Second comment -->
5
- <!-- Multiple comments before any element should work -->
6
- <output>Success</output>
@@ -1,8 +0,0 @@
1
- <!-- TEST: defvar_multiple -->
2
- <!-- EXPECT: a=1, b=2, c=3 -->
3
- <dirac>
4
- <defvar name="a" value="1" />
5
- <defvar name="b" value="2" />
6
- <defvar name="c" value="3" />
7
- <output>a=<variable name="a" />, b=<variable name="b" />, c=<variable name="c" /></output>
8
- </dirac>
@@ -1,22 +0,0 @@
1
- <!-- TEST: environment_basic -->
2
- <!-- EXPECT: HOME exists: true USER exists: true -->
3
- <dirac>
4
- <defvar name="home"><environment name="HOME" /></defvar>
5
- <defvar name="user"><environment name="USER" /></defvar>
6
-
7
- <output>HOME exists: </output>
8
- <test-if test="$home != ''">
9
- <output>true</output>
10
- </test-if>
11
- <test-if test="$home == ''">
12
- <output>false</output>
13
- </test-if>
14
-
15
- <output> USER exists: </output>
16
- <test-if test="$user != ''">
17
- <output>true</output>
18
- </test-if>
19
- <test-if test="$user == ''">
20
- <output>false</output>
21
- </test-if>
22
- </dirac>
@@ -1,5 +0,0 @@
1
- <!-- TEST: environment_nonexistent -->
2
- <!-- EXPECT: Empty: [] -->
3
- <dirac>
4
- <output>Empty: [<environment name="NONEXISTENT_VAR_12345_TEST" />]</output>
5
- </dirac>
@@ -1,15 +0,0 @@
1
- <!-- TEST: environment_with_defvar -->
2
- <!-- EXPECT: Path exists: true -->
3
- <dirac>
4
- <defvar name="mypath">
5
- <environment name="PATH" />
6
- </defvar>
7
-
8
- <output>Path exists: </output>
9
- <test-if test="$mypath != ''">
10
- <output>true</output>
11
- </test-if>
12
- <test-if test="$mypath == ''">
13
- <output>false</output>
14
- </test-if>
15
- </dirac>
@@ -1,6 +0,0 @@
1
- <!-- TEST: eval_basic -->
2
- <!-- EXPECT: Calculated: 42 -->
3
- <dirac>
4
- <eval name="result">return 6 * 7;</eval>
5
- <output>Calculated: <variable name="result" /></output>
6
- </dirac>
@@ -1,8 +0,0 @@
1
- <!-- TEST: eval_with_variables -->
2
- <!-- EXPECT: Sum: 30 -->
3
- <dirac>
4
- <defvar name="a" value="10" />
5
- <defvar name="b" value="20" />
6
- <eval name="sum">return parseInt(a) + parseInt(b);</eval>
7
- <output>Sum: <variable name="sum" /></output>
8
- </dirac>
@@ -1,10 +0,0 @@
1
- <!-- TEST: exception_handling -->
2
- <!-- EXPECT: Caught: test error -->
3
- <dirac>
4
- <try>
5
- <throw name="test_exception">test error</throw>
6
- </try>
7
- <catch name="test_exception">
8
- <output>Caught: <exception /></output>
9
- </catch>
10
- </dirac>
@@ -1,11 +0,0 @@
1
- <!-- TEST: expr_basic -->
2
- <!-- EXPECT: Result: 15 -->
3
- <dirac>
4
- <defvar name="a" value="10" />
5
- <defvar name="b" value="5" />
6
- <output>Result: </output>
7
- <expr eval="plus">
8
- <arg><variable name="a" /></arg>
9
- <arg><variable name="b" /></arg>
10
- </expr>
11
- </dirac>
@@ -1,19 +0,0 @@
1
- <!-- TEST: extend_basic -->
2
- <!-- EXPECT: In parent, calling: Child nested -->
3
- <dirac>
4
- <subroutine name="parent">
5
- <subroutine name="nested">
6
- <output>Parent nested</output>
7
- </subroutine>
8
- <output>In parent, calling: </output>
9
- <call name="nested" />
10
- </subroutine>
11
-
12
- <subroutine name="child" extends="parent">
13
- <subroutine name="nested">
14
- <output>Child nested</output>
15
- </subroutine>
16
- </subroutine>
17
-
18
- <call name="child" />
19
- </dirac>
@@ -1,26 +0,0 @@
1
- <!-- TEST: extend_inheritance_chain -->
2
- <!-- EXPECT: A X C -->
3
- <dirac>
4
- <subroutine name="data">
5
- <subroutine name="field1">
6
- <output>A</output>
7
- </subroutine>
8
- <subroutine name="field2">
9
- <output>B</output>
10
- </subroutine>
11
- <subroutine name="field3">
12
- <output>C</output>
13
- </subroutine>
14
- <call name="field1" />
15
- <call name="field2" />
16
- <call name="field3" />
17
- </subroutine>
18
-
19
- <subroutine name="data" extends="data">
20
- <subroutine name="field2">
21
- <output>X</output>
22
- </subroutine>
23
- </subroutine>
24
-
25
- <call name="data" />
26
- </dirac>
@@ -1,24 +0,0 @@
1
- <!-- TEST: extend_multiple_nested -->
2
- <!-- EXPECT: 63 , M -->
3
- <dirac>
4
- <subroutine name="base">
5
- <subroutine name="age">
6
- <output>60</output>
7
- </subroutine>
8
- <subroutine name="gender">
9
- <output>M</output>
10
- </subroutine>
11
- <parameters select="*" />
12
- </subroutine>
13
-
14
- <subroutine name="base" extends="base">
15
- <subroutine name="age">
16
- <output>63</output>
17
- </subroutine>
18
- <parameters select="*" />
19
- </subroutine>
20
-
21
- <base><age /></base>
22
- <output>,</output>
23
- <base><gender /></base>
24
- </dirac>
@@ -1,19 +0,0 @@
1
- <!-- TEST: extend_self -->
2
- <!-- EXPECT: Age: 63 -->
3
- <dirac>
4
- <subroutine name="person">
5
- <subroutine name="age">
6
- <output>60</output>
7
- </subroutine>
8
- <output>Age: </output>
9
- <call name="age" />
10
- </subroutine>
11
-
12
- <subroutine name="person" extends="person">
13
- <subroutine name="age">
14
- <output>63</output>
15
- </subroutine>
16
- </subroutine>
17
-
18
- <call name="person" />
19
- </dirac>
@@ -1,14 +0,0 @@
1
- <!-- TEST: extend_with_parameters -->
2
- <!-- EXPECT: Hello, World -->
3
- <dirac>
4
- <subroutine name="greet" param-name="string:required">
5
- <output>Hello, </output>
6
- <output><variable name="name" /></output>
7
- </subroutine>
8
-
9
- <subroutine name="greet" extends="greet" param-name="string:required">
10
- <!-- Child body is not executed with extends, only nested subroutines override -->
11
- </subroutine>
12
-
13
- <greet name="World" />
14
- </dirac>
@@ -1,22 +0,0 @@
1
- <!-- TEST: generate_and_execute_dirac -->
2
- <!-- EXPECT: Generated file executed
3
- Result: 42 -->
4
- <dirac>
5
- <!-- Define a DIRAC script as literal -->
6
- <defvar name="generated_script" literal="true" trim="false">
7
- <dirac>
8
- <defvar name="value">42</defvar>
9
- <output>Result: <variable name="value" /></output>
10
- </dirac>
11
- </defvar>
12
-
13
- <!-- Write to file -->
14
- <output file="temp-generated.di"><variable name="generated_script" /></output>
15
-
16
- <!-- Execute the generated script -->
17
- <output>Generated file executed</output>
18
- <system shell="bash">
19
- node dist/cli.js temp-generated.di
20
- rm temp-generated.di
21
- </system>
22
- </dirac>
@@ -1,17 +0,0 @@
1
- <!-- TEST: if_conditional_true -->
2
- <!-- EXPECT: Match! -->
3
- <dirac>
4
- <defvar name="x" value="5" />
5
- <if>
6
- <cond eval="eq">
7
- <arg><variable name="x" /></arg>
8
- <arg>5</arg>
9
- </cond>
10
- <then>
11
- <output>Match!</output>
12
- </then>
13
- <else>
14
- <output>No match!</output>
15
- </else>
16
- </if>
17
- </dirac>
@@ -1,11 +0,0 @@
1
- <!-- TEST: if_else -->
2
- <!-- EXPECT: Value is small -->
3
- <dirac>
4
- <defvar name="num" value="5" />
5
- <test-if test="$num > 10">
6
- <output>Value is large</output>
7
- </test-if>
8
- <test-if test="$num <= 10">
9
- <output>Value is small</output>
10
- </test-if>
11
- </dirac>
@@ -1,8 +0,0 @@
1
- <!-- TEST: if_with_variables -->
2
- <!-- EXPECT: Match found -->
3
- <dirac>
4
- <defvar name="status" value="active" />
5
- <test-if test="$status == active">
6
- <output>Match found</output>
7
- </test-if>
8
- </dirac>
@@ -1,6 +0,0 @@
1
- <!-- TEST: import_basic -->
2
- <!-- EXPECT: 25 -->
3
- <dirac>
4
- <import src="./examples/lib/math.di" />
5
- <call name="SQUARE" x="5" />
6
- </dirac>
@@ -1,5 +0,0 @@
1
- <!-- TEST: input_file_all -->
2
- <!-- EXPECT: line one line two line three -->
3
- <dirac>
4
- <input source="file" path="tests/test-input.txt" mode="all" />
5
- </dirac>
@@ -1,15 +0,0 @@
1
- <!-- TEST: input_file_line -->
2
- <!-- EXPECT: First: line one Second: line two Third: line three EOF: -->
3
- <dirac>
4
- <output>First: </output>
5
- <input source="file" path="tests/test-input.txt" mode="line" />
6
-
7
- <output> Second: </output>
8
- <input source="file" path="tests/test-input.txt" mode="line" />
9
-
10
- <output> Third: </output>
11
- <input source="file" path="tests/test-input.txt" mode="line" />
12
-
13
- <output> EOF: </output>
14
- <input source="file" path="tests/test-input.txt" mode="line" />
15
- </dirac>
@@ -1,12 +0,0 @@
1
- <!-- TEST: input_file_with_loop -->
2
- <!-- EXPECT: line one | line two | line three | -->
3
- <dirac>
4
- <loop count="3">
5
- <defvar name="line">
6
- <input source="file" path="tests/test-input.txt" mode="line" />
7
- </defvar>
8
-
9
- <variable name="line" />
10
- <output> | </output>
11
- </loop>
12
- </dirac>
@@ -1,8 +0,0 @@
1
- <!-- TEST: input_stdin_all -->
2
- <!-- EXPECT: hello from stdin -->
3
- <dirac>
4
- <defvar name="data">
5
- <input source="stdin" mode="all"/>
6
- </defvar>
7
- <output><variable name="data"/></output>
8
- </dirac>
@@ -1 +0,0 @@
1
- hello from stdin
@@ -1,17 +0,0 @@
1
- <!-- TEST: llm_execute_with_validation -->
2
- <!-- EXPECT: Background color is: blue -->
3
-
4
- <dirac>
5
- <subroutine name="set-color"
6
- description="Set a background color"
7
- param-color="string:required:Color name">
8
- <parameters select="@color"/>
9
- <output>Background color is: <variable name="color" /></output>
10
- </subroutine>
11
-
12
- <!-- Test: LLM with execute=true and validate=true should work -->
13
- <!-- This tests that DIRAC-ROOT wrapper tag is properly skipped during validation -->
14
- <llm execute="true" validate="true" maxTokens="100">
15
- Set the background color to blue
16
- </llm>
17
- </dirac>
@@ -1,9 +0,0 @@
1
- <!-- TEST: loop_basic -->
2
- <!-- EXPECT: 0 1 2 -->
3
- <dirac>
4
- <defvar name="i" value="0" />
5
- <loop count="3">
6
- <output><variable name="i" /></output>
7
- <assign name="i"><eval><variable name="i" /> + 1</eval></assign>
8
- </loop>
9
- </dirac>
@@ -1,10 +0,0 @@
1
- <!-- TEST: loop_nested -->
2
- <!-- EXPECT: 0-A 0-B 1-A 1-B -->
3
- <dirac>
4
- <loop count="2" var="i">
5
- <loop count="2" var="j">
6
- <eval name="letter">return j === 0 ? 'A' : 'B';</eval>
7
- <output><variable name="i" />-<variable name="letter" /> </output>
8
- </loop>
9
- </loop>
10
- </dirac>
@@ -1,8 +0,0 @@
1
- <!-- TEST: loop_with_eval -->
2
- <!-- EXPECT: 0 2 4 -->
3
- <dirac>
4
- <loop count="3" var="i">
5
- <eval name="doubled">return parseInt(i) * 2;</eval>
6
- <output><variable name="doubled" /></output>
7
- </loop>
8
- </dirac>
@@ -1,6 +0,0 @@
1
- <!-- TEST: no_root_element -->
2
- <!-- EXPECT: Hello World -->
3
- <!-- Test case without explicit <dirac> root - should work with DIRAC-ROOT wrapper -->
4
- <output>Hello</output>
5
- <output> </output>
6
- <output>World</output>
@@ -1,19 +0,0 @@
1
- <!-- TEST: output_file_basic -->
2
- <!-- EXPECT: stdout output
3
- File written -->
4
- <dirac>
5
- <!-- Write to file -->
6
- <output file="output-test-temp.txt">File line 1</output>
7
- <output file="output-test-temp.txt">File line 2</output>
8
-
9
- <!-- Output to stdout to verify test runs -->
10
- <output>stdout output</output>
11
-
12
- <!-- Use system to verify file and clean up -->
13
- <system shell="bash">
14
- if [ -f output-test-temp.txt ]; then
15
- echo "File written"
16
- rm output-test-temp.txt
17
- fi
18
- </system>
19
- </dirac>
@@ -1,9 +0,0 @@
1
- <!-- TEST: output_multiple -->
2
- <!-- EXPECT: Line 1
3
- Line 2
4
- Line 3 -->
5
- <dirac>
6
- <output>Line 1</output>
7
- <output>Line 2</output>
8
- <output>Line 3</output>
9
- </dirac>
@@ -1,6 +0,0 @@
1
- <!-- TEST: parameters_basic -->
2
- <!-- EXPECT: Skipped -->
3
- <dirac>
4
- <!-- This test requires HTTP request context, skipped for now -->
5
- <output>Skipped</output>
6
- </dirac>
@@ -1,7 +0,0 @@
1
- <!-- TEST: require_module_basic -->
2
- <!-- EXPECT: Platform: darwin -->
3
- <dirac>
4
- <require_module name="os" var="os" />
5
- <eval name="platform">return os.platform();</eval>
6
- <output>Platform: <variable name="platform" /></output>
7
- </dirac>
@@ -1,9 +0,0 @@
1
- <!-- TEST: subroutine_call -->
2
- <!-- EXPECT: Hello, Alice! -->
3
- <dirac>
4
- <subroutine name="greet" param-name="string">
5
- <output>Hello, <variable name="name" />!</output>
6
- </subroutine>
7
-
8
- <greet name="Alice" />
9
- </dirac>
@@ -1,10 +0,0 @@
1
- <!-- TEST: subroutine_multiple_params -->
2
- <!-- EXPECT: John Doe -->
3
- <dirac>
4
- <subroutine name="fullname" param-first="string" param-last="string">
5
- <eval name="result">return first + ' ' + last;</eval>
6
- <output><variable name="result" /></output>
7
- </subroutine>
8
-
9
- <call name="fullname" first="John" last="Doe" />
10
- </dirac>