eyeling 1.34.4 → 1.34.5

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 (252) hide show
  1. package/docs/eyelang-guide.md +1 -1
  2. package/docs/eyelang-language-reference.md +16 -31
  3. package/package.json +1 -1
  4. package/test/eyelang/conformance/README.md +9 -11
  5. package/test/eyelang/conformance/cases/001_fact_output.pl +4 -0
  6. package/test/eyelang/conformance/cases/002_rule_recursion.pl +7 -0
  7. package/test/eyelang/conformance/cases/002_rule_recursion.query +1 -0
  8. package/test/eyelang/conformance/cases/003_terms_and_readback.pl +16 -0
  9. package/test/eyelang/conformance/cases/003_terms_and_readback.query +1 -0
  10. package/test/eyelang/conformance/cases/004_conjunction_and_parentheses.pl +5 -0
  11. package/test/eyelang/conformance/cases/004_conjunction_and_parentheses.query +1 -0
  12. package/test/eyelang/conformance/cases/005_list_deconstruction.pl +6 -0
  13. package/test/eyelang/conformance/cases/005_list_deconstruction.query +1 -0
  14. package/test/eyelang/conformance/cases/006_comma_formula_data.pl +4 -0
  15. package/test/eyelang/conformance/cases/006_comma_formula_data.query +1 -0
  16. package/test/eyelang/conformance/cases/007_anonymous_variables.pl +5 -0
  17. package/test/eyelang/conformance/cases/007_anonymous_variables.query +1 -0
  18. package/test/eyelang/conformance/cases/008_graphic_atoms.pl +6 -0
  19. package/test/eyelang/conformance/cases/008_graphic_atoms.query +1 -0
  20. package/test/eyelang/conformance/cases/009_comments_and_whitespace.pl +5 -0
  21. package/test/eyelang/conformance/cases/009_comments_and_whitespace.query +1 -0
  22. package/test/eyelang/conformance/cases/010_variable_scope_and_reuse.pl +8 -0
  23. package/test/eyelang/conformance/cases/010_variable_scope_and_reuse.query +1 -0
  24. package/test/eyelang/conformance/cases/011_predicate_arity.pl +6 -0
  25. package/test/eyelang/conformance/cases/011_predicate_arity.query +1 -0
  26. package/test/eyelang/conformance/cases/012_nested_compound_unification.pl +5 -0
  27. package/test/eyelang/conformance/cases/012_nested_compound_unification.query +1 -0
  28. package/test/eyelang/conformance/cases/013_multiple_clauses_order.pl +6 -0
  29. package/test/eyelang/conformance/cases/013_multiple_clauses_order.query +1 -0
  30. package/test/eyelang/conformance/cases/014_failure_filters_answers.pl +7 -0
  31. package/test/eyelang/conformance/cases/014_failure_filters_answers.query +1 -0
  32. package/test/eyelang/conformance/cases/015_improper_list_unification.pl +6 -0
  33. package/test/eyelang/conformance/cases/015_improper_list_unification.query +1 -0
  34. package/test/eyelang/conformance/cases/016_zero_arity_compound.pl +4 -0
  35. package/test/eyelang/conformance/cases/016_zero_arity_compound.query +1 -0
  36. package/test/eyelang/conformance/cases/017_three_step_recursion.pl +8 -0
  37. package/test/eyelang/conformance/cases/017_three_step_recursion.query +1 -0
  38. package/test/eyelang/conformance/cases/018_quoted_atom_readback.pl +6 -0
  39. package/test/eyelang/conformance/cases/018_quoted_atom_readback.query +1 -0
  40. package/test/eyelang/conformance/cases/019_parenthesized_three_conjuncts.pl +7 -0
  41. package/test/eyelang/conformance/cases/019_parenthesized_three_conjuncts.query +1 -0
  42. package/test/eyelang/conformance/cases/020_nested_list_terms.pl +5 -0
  43. package/test/eyelang/conformance/cases/020_nested_list_terms.query +1 -0
  44. package/test/eyelang/conformance/cases/021_repeated_variable_head.pl +7 -0
  45. package/test/eyelang/conformance/cases/022_rule_head_structure.pl +5 -0
  46. package/test/eyelang/conformance/cases/023_quoted_escapes_readback.pl +5 -0
  47. package/test/eyelang/conformance/cases/024_numeric_literal_readback.pl +6 -0
  48. package/test/eyelang/conformance/cases/025_body_parentheses_with_formula_data.pl +5 -0
  49. package/test/eyelang/conformance/cases/026_underscore_named_variable_reuse.pl +5 -0
  50. package/test/eyelang/conformance/cases/027_default_derived_output.pl +5 -0
  51. package/test/eyelang/conformance/cases/028_materialize_focus.pl +5 -0
  52. package/test/eyelang/conformance/cases/029_arithmetic_and_comparison.pl +11 -0
  53. package/test/eyelang/conformance/cases/029_arithmetic_and_comparison.query +1 -0
  54. package/test/eyelang/conformance/cases/030_strings_and_atoms.pl +4 -0
  55. package/test/eyelang/conformance/cases/030_strings_and_atoms.query +1 -0
  56. package/test/eyelang/conformance/cases/031_lists_aggregation_ordering.pl +10 -0
  57. package/test/eyelang/conformance/cases/031_lists_aggregation_ordering.query +1 -0
  58. package/test/eyelang/conformance/cases/032_holds_parts.pl +4 -0
  59. package/test/eyelang/conformance/cases/033_negation_once_generators.pl +7 -0
  60. package/test/eyelang/conformance/cases/033_negation_once_generators.query +1 -0
  61. package/test/eyelang/conformance/cases/034_equality_and_inequality.pl +6 -0
  62. package/test/eyelang/conformance/cases/034_equality_and_inequality.query +1 -0
  63. package/test/eyelang/conformance/cases/035_list_relations.pl +5 -0
  64. package/test/eyelang/conformance/cases/035_list_relations.query +1 -0
  65. package/test/eyelang/conformance/cases/036_append_splits.pl +3 -0
  66. package/test/eyelang/conformance/cases/036_append_splits.query +1 -0
  67. package/test/eyelang/conformance/cases/037_matching_and_comparison.pl +7 -0
  68. package/test/eyelang/conformance/cases/037_matching_and_comparison.query +1 -0
  69. package/test/eyelang/conformance/cases/038_memoize_declaration.pl +8 -0
  70. package/test/eyelang/conformance/cases/038_memoize_declaration.query +1 -0
  71. package/test/eyelang/conformance/cases/039_numeric_functions.pl +9 -0
  72. package/test/eyelang/conformance/cases/039_numeric_functions.query +1 -0
  73. package/test/eyelang/conformance/cases/040_between_enumeration.pl +3 -0
  74. package/test/eyelang/conformance/cases/040_between_enumeration.query +1 -0
  75. package/test/eyelang/conformance/cases/041_smallest_divisor.pl +3 -0
  76. package/test/eyelang/conformance/cases/041_smallest_divisor.query +1 -0
  77. package/test/eyelang/conformance/cases/042_negation_filter.pl +7 -0
  78. package/test/eyelang/conformance/cases/042_negation_filter.query +1 -0
  79. package/test/eyelang/conformance/cases/043_once_user_predicate.pl +5 -0
  80. package/test/eyelang/conformance/cases/043_once_user_predicate.query +1 -0
  81. package/test/eyelang/conformance/cases/044_findall_user_goal.pl +6 -0
  82. package/test/eyelang/conformance/cases/044_findall_user_goal.query +1 -0
  83. package/test/eyelang/conformance/cases/045_sort_deduplicates_atoms.pl +3 -0
  84. package/test/eyelang/conformance/cases/045_sort_deduplicates_atoms.query +1 -0
  85. package/test/eyelang/conformance/cases/046_append_bound_prefix_suffix.pl +4 -0
  86. package/test/eyelang/conformance/cases/046_append_bound_prefix_suffix.query +1 -0
  87. package/test/eyelang/conformance/cases/047_nth0_index_generation.pl +3 -0
  88. package/test/eyelang/conformance/cases/047_nth0_index_generation.query +1 -0
  89. package/test/eyelang/conformance/cases/048_set_nth0_edges.pl +4 -0
  90. package/test/eyelang/conformance/cases/048_set_nth0_edges.query +1 -0
  91. package/test/eyelang/conformance/cases/049_select_duplicate_occurrences.pl +3 -0
  92. package/test/eyelang/conformance/cases/049_select_duplicate_occurrences.query +1 -0
  93. package/test/eyelang/conformance/cases/050_not_member_filter.pl +6 -0
  94. package/test/eyelang/conformance/cases/050_not_member_filter.query +1 -0
  95. package/test/eyelang/conformance/cases/051_nested_holds_parts.pl +4 -0
  96. package/test/eyelang/conformance/cases/052_holds_member.pl +3 -0
  97. package/test/eyelang/conformance/cases/053_materialize_excludes_source_fact.pl +6 -0
  98. package/test/eyelang/conformance/cases/054_numeric_and_lexical_comparison.pl +5 -0
  99. package/test/eyelang/conformance/cases/054_numeric_and_lexical_comparison.query +1 -0
  100. package/test/eyelang/conformance/cases/055_string_matching_filters.pl +6 -0
  101. package/test/eyelang/conformance/cases/055_string_matching_filters.query +1 -0
  102. package/test/eyelang/conformance/cases/056_string_and_atom_concat.pl +3 -0
  103. package/test/eyelang/conformance/cases/056_string_and_atom_concat.query +1 -0
  104. package/test/eyelang/conformance/cases/057_countall_empty_and_nonempty.pl +4 -0
  105. package/test/eyelang/conformance/cases/057_countall_empty_and_nonempty.query +1 -0
  106. package/test/eyelang/conformance/cases/058_sumall_numeric_template.pl +5 -0
  107. package/test/eyelang/conformance/cases/058_sumall_numeric_template.query +1 -0
  108. package/test/eyelang/conformance/cases/059_aggregate_min_template.pl +5 -0
  109. package/test/eyelang/conformance/cases/059_aggregate_min_template.query +1 -0
  110. package/test/eyelang/conformance/cases/060_aggregate_max_compound_key.pl +5 -0
  111. package/test/eyelang/conformance/cases/060_aggregate_max_compound_key.query +1 -0
  112. package/test/eyelang/conformance/cases/061_date_difference.pl +4 -0
  113. package/test/eyelang/conformance/cases/062_reusable_numeric_builtins.pl +10 -0
  114. package/test/eyelang/conformance/cases/063_reusable_list_builtins.pl +11 -0
  115. package/test/eyelang/conformance/cases/064_reusable_string_builtins.pl +12 -0
  116. package/test/eyelang/conformance/cases/065_reusable_term_control_builtins.pl +11 -0
  117. package/test/eyelang/conformance/cases/066_numeric_edges.pl +14 -0
  118. package/test/eyelang/conformance/cases/067_list_edges.pl +10 -0
  119. package/test/eyelang/conformance/cases/068_list_generation_order.pl +7 -0
  120. package/test/eyelang/conformance/cases/069_list_summaries_and_sets.pl +9 -0
  121. package/test/eyelang/conformance/cases/070_matches_named_captures.pl +13 -0
  122. package/test/eyelang/conformance/cases/071_string_edges.pl +10 -0
  123. package/test/eyelang/conformance/cases/072_string_conversions.pl +10 -0
  124. package/test/eyelang/conformance/cases/073_term_introspection_edges.pl +10 -0
  125. package/test/eyelang/conformance/cases/074_forall_edges.pl +10 -0
  126. package/test/eyelang/conformance/cases/075_aggregation_edges.pl +12 -0
  127. package/test/eyelang/conformance/cases/076_composed_reusable_builtins.pl +8 -0
  128. package/test/eyelang/conformance/cases/077_recursive_path_with_lists.pl +10 -0
  129. package/test/eyelang/conformance/cases/078_mutual_recursion_with_arithmetic.pl +7 -0
  130. package/test/eyelang/conformance/cases/079_big_integer_arithmetic.pl +8 -0
  131. package/test/eyelang/conformance/cases/080_rounding_modes.pl +10 -0
  132. package/test/eyelang/conformance/cases/081_zero_safe_numeric_functions.pl +9 -0
  133. package/test/eyelang/conformance/cases/082_comparison_semantics.pl +10 -0
  134. package/test/eyelang/conformance/cases/083_between_modes_and_empty_ranges.pl +8 -0
  135. package/test/eyelang/conformance/cases/084_append_and_select_composition.pl +7 -0
  136. package/test/eyelang/conformance/cases/085_nth_and_update_edges.pl +8 -0
  137. package/test/eyelang/conformance/cases/086_slicing_pipeline.pl +10 -0
  138. package/test/eyelang/conformance/cases/087_sort_reverse_length.pl +8 -0
  139. package/test/eyelang/conformance/cases/088_list_summaries_failures.pl +8 -0
  140. package/test/eyelang/conformance/cases/089_string_split_join_pipeline.pl +7 -0
  141. package/test/eyelang/conformance/cases/090_string_substring_replace_edges.pl +9 -0
  142. package/test/eyelang/conformance/cases/091_string_case_and_trim.pl +7 -0
  143. package/test/eyelang/conformance/cases/092_scalar_string_conversions.pl +9 -0
  144. package/test/eyelang/conformance/cases/093_regex_named_captures_context.pl +8 -0
  145. package/test/eyelang/conformance/cases/094_context_holds_enumeration.pl +7 -0
  146. package/test/eyelang/conformance/cases/095_term_introspection_roundtrip.pl +8 -0
  147. package/test/eyelang/conformance/cases/096_functor_scalar_edges.pl +8 -0
  148. package/test/eyelang/conformance/cases/097_control_negation_once_forall.pl +13 -0
  149. package/test/eyelang/conformance/cases/098_aggregation_nested_templates.pl +11 -0
  150. package/test/eyelang/conformance/cases/099_materialize_multiple_arities.pl +8 -0
  151. package/test/eyelang/conformance/cases/100_reusable_builtin_workflow.pl +10 -0
  152. package/test/eyelang/conformance/expected/001_fact_output.pl +1 -0
  153. package/test/eyelang/conformance/expected/002_rule_recursion.pl +2 -0
  154. package/test/eyelang/conformance/expected/003_terms_and_readback.pl +13 -0
  155. package/test/eyelang/conformance/expected/004_conjunction_and_parentheses.pl +1 -0
  156. package/test/eyelang/conformance/expected/005_list_deconstruction.pl +2 -0
  157. package/test/eyelang/conformance/expected/006_comma_formula_data.pl +1 -0
  158. package/test/eyelang/conformance/expected/007_anonymous_variables.pl +1 -0
  159. package/test/eyelang/conformance/expected/008_graphic_atoms.pl +3 -0
  160. package/test/eyelang/conformance/expected/009_comments_and_whitespace.pl +2 -0
  161. package/test/eyelang/conformance/expected/010_variable_scope_and_reuse.pl +2 -0
  162. package/test/eyelang/conformance/expected/011_predicate_arity.pl +2 -0
  163. package/test/eyelang/conformance/expected/012_nested_compound_unification.pl +2 -0
  164. package/test/eyelang/conformance/expected/013_multiple_clauses_order.pl +2 -0
  165. package/test/eyelang/conformance/expected/014_failure_filters_answers.pl +1 -0
  166. package/test/eyelang/conformance/expected/015_improper_list_unification.pl +3 -0
  167. package/test/eyelang/conformance/expected/016_zero_arity_compound.pl +1 -0
  168. package/test/eyelang/conformance/expected/017_three_step_recursion.pl +3 -0
  169. package/test/eyelang/conformance/expected/018_quoted_atom_readback.pl +3 -0
  170. package/test/eyelang/conformance/expected/019_parenthesized_three_conjuncts.pl +1 -0
  171. package/test/eyelang/conformance/expected/020_nested_list_terms.pl +2 -0
  172. package/test/eyelang/conformance/expected/021_repeated_variable_head.pl +2 -0
  173. package/test/eyelang/conformance/expected/022_rule_head_structure.pl +2 -0
  174. package/test/eyelang/conformance/expected/023_quoted_escapes_readback.pl +2 -0
  175. package/test/eyelang/conformance/expected/024_numeric_literal_readback.pl +3 -0
  176. package/test/eyelang/conformance/expected/025_body_parentheses_with_formula_data.pl +1 -0
  177. package/test/eyelang/conformance/expected/026_underscore_named_variable_reuse.pl +1 -0
  178. package/test/eyelang/conformance/expected/027_default_derived_output.pl +3 -0
  179. package/test/eyelang/conformance/expected/028_materialize_focus.pl +1 -0
  180. package/test/eyelang/conformance/expected/029_arithmetic_and_comparison.pl +9 -0
  181. package/test/eyelang/conformance/expected/030_strings_and_atoms.pl +2 -0
  182. package/test/eyelang/conformance/expected/031_lists_aggregation_ordering.pl +9 -0
  183. package/test/eyelang/conformance/expected/032_holds_parts.pl +3 -0
  184. package/test/eyelang/conformance/expected/033_negation_once_generators.pl +2 -0
  185. package/test/eyelang/conformance/expected/034_equality_and_inequality.pl +4 -0
  186. package/test/eyelang/conformance/expected/035_list_relations.pl +4 -0
  187. package/test/eyelang/conformance/expected/036_append_splits.pl +3 -0
  188. package/test/eyelang/conformance/expected/037_matching_and_comparison.pl +5 -0
  189. package/test/eyelang/conformance/expected/038_memoize_declaration.pl +2 -0
  190. package/test/eyelang/conformance/expected/039_numeric_functions.pl +7 -0
  191. package/test/eyelang/conformance/expected/040_between_enumeration.pl +3 -0
  192. package/test/eyelang/conformance/expected/041_smallest_divisor.pl +1 -0
  193. package/test/eyelang/conformance/expected/042_negation_filter.pl +2 -0
  194. package/test/eyelang/conformance/expected/043_once_user_predicate.pl +1 -0
  195. package/test/eyelang/conformance/expected/044_findall_user_goal.pl +1 -0
  196. package/test/eyelang/conformance/expected/045_sort_deduplicates_atoms.pl +1 -0
  197. package/test/eyelang/conformance/expected/046_append_bound_prefix_suffix.pl +2 -0
  198. package/test/eyelang/conformance/expected/047_nth0_index_generation.pl +1 -0
  199. package/test/eyelang/conformance/expected/048_set_nth0_edges.pl +2 -0
  200. package/test/eyelang/conformance/expected/049_select_duplicate_occurrences.pl +2 -0
  201. package/test/eyelang/conformance/expected/050_not_member_filter.pl +1 -0
  202. package/test/eyelang/conformance/expected/051_nested_holds_parts.pl +3 -0
  203. package/test/eyelang/conformance/expected/052_holds_member.pl +2 -0
  204. package/test/eyelang/conformance/expected/053_materialize_excludes_source_fact.pl +1 -0
  205. package/test/eyelang/conformance/expected/054_numeric_and_lexical_comparison.pl +3 -0
  206. package/test/eyelang/conformance/expected/055_string_matching_filters.pl +2 -0
  207. package/test/eyelang/conformance/expected/056_string_and_atom_concat.pl +1 -0
  208. package/test/eyelang/conformance/expected/057_countall_empty_and_nonempty.pl +1 -0
  209. package/test/eyelang/conformance/expected/058_sumall_numeric_template.pl +1 -0
  210. package/test/eyelang/conformance/expected/059_aggregate_min_template.pl +1 -0
  211. package/test/eyelang/conformance/expected/060_aggregate_max_compound_key.pl +1 -0
  212. package/test/eyelang/conformance/expected/061_date_difference.pl +2 -0
  213. package/test/eyelang/conformance/expected/062_reusable_numeric_builtins.pl +8 -0
  214. package/test/eyelang/conformance/expected/063_reusable_list_builtins.pl +9 -0
  215. package/test/eyelang/conformance/expected/064_reusable_string_builtins.pl +10 -0
  216. package/test/eyelang/conformance/expected/065_reusable_term_control_builtins.pl +6 -0
  217. package/test/eyelang/conformance/expected/066_numeric_edges.pl +12 -0
  218. package/test/eyelang/conformance/expected/067_list_edges.pl +8 -0
  219. package/test/eyelang/conformance/expected/068_list_generation_order.pl +10 -0
  220. package/test/eyelang/conformance/expected/069_list_summaries_and_sets.pl +7 -0
  221. package/test/eyelang/conformance/expected/070_matches_named_captures.pl +1 -0
  222. package/test/eyelang/conformance/expected/071_string_edges.pl +8 -0
  223. package/test/eyelang/conformance/expected/072_string_conversions.pl +8 -0
  224. package/test/eyelang/conformance/expected/073_term_introspection_edges.pl +8 -0
  225. package/test/eyelang/conformance/expected/074_forall_edges.pl +5 -0
  226. package/test/eyelang/conformance/expected/075_aggregation_edges.pl +7 -0
  227. package/test/eyelang/conformance/expected/076_composed_reusable_builtins.pl +5 -0
  228. package/test/eyelang/conformance/expected/077_recursive_path_with_lists.pl +3 -0
  229. package/test/eyelang/conformance/expected/078_mutual_recursion_with_arithmetic.pl +7 -0
  230. package/test/eyelang/conformance/expected/079_big_integer_arithmetic.pl +6 -0
  231. package/test/eyelang/conformance/expected/080_rounding_modes.pl +8 -0
  232. package/test/eyelang/conformance/expected/081_zero_safe_numeric_functions.pl +7 -0
  233. package/test/eyelang/conformance/expected/082_comparison_semantics.pl +8 -0
  234. package/test/eyelang/conformance/expected/083_between_modes_and_empty_ranges.pl +8 -0
  235. package/test/eyelang/conformance/expected/084_append_and_select_composition.pl +10 -0
  236. package/test/eyelang/conformance/expected/085_nth_and_update_edges.pl +8 -0
  237. package/test/eyelang/conformance/expected/086_slicing_pipeline.pl +7 -0
  238. package/test/eyelang/conformance/expected/087_sort_reverse_length.pl +6 -0
  239. package/test/eyelang/conformance/expected/088_list_summaries_failures.pl +6 -0
  240. package/test/eyelang/conformance/expected/089_string_split_join_pipeline.pl +4 -0
  241. package/test/eyelang/conformance/expected/090_string_substring_replace_edges.pl +7 -0
  242. package/test/eyelang/conformance/expected/091_string_case_and_trim.pl +5 -0
  243. package/test/eyelang/conformance/expected/092_scalar_string_conversions.pl +7 -0
  244. package/test/eyelang/conformance/expected/093_regex_named_captures_context.pl +5 -0
  245. package/test/eyelang/conformance/expected/094_context_holds_enumeration.pl +8 -0
  246. package/test/eyelang/conformance/expected/095_term_introspection_roundtrip.pl +6 -0
  247. package/test/eyelang/conformance/expected/096_functor_scalar_edges.pl +6 -0
  248. package/test/eyelang/conformance/expected/097_control_negation_once_forall.pl +5 -0
  249. package/test/eyelang/conformance/expected/098_aggregation_nested_templates.pl +5 -0
  250. package/test/eyelang/conformance/expected/099_materialize_multiple_arities.pl +4 -0
  251. package/test/eyelang/conformance/expected/100_reusable_builtin_workflow.pl +6 -0
  252. package/test/eyelang/run-conformance.mjs +20 -22
@@ -0,0 +1,5 @@
1
+ answer(all_pairs, [result(alice, math, 9), result(alice, logic, 7), result(bob, math, 5), result(bob, logic, 8)]).
2
+ answer(count_high, 2).
3
+ answer(sum_alice, 16).
4
+ answer(best_score, pair(9, result(alice, math))).
5
+ answer(lowest_pair, pair([5, bob], math)).
@@ -0,0 +1,4 @@
1
+ answer(a).
2
+ answer(b).
3
+ answer(a, doubled).
4
+ answer(b, doubled).
@@ -0,0 +1,6 @@
1
+ answer(total(alice), 15).
2
+ answer(total(bob), 6).
3
+ answer(maximum(alice), 7).
4
+ answer(maximum(bob), 4).
5
+ answer(report(alice), "alice:3").
6
+ answer(report(bob), "bob:2").
@@ -9,35 +9,34 @@ import { fileURLToPath } from 'node:url';
9
9
  import { TestReporter, isMainModule } from './test-style.mjs';
10
10
 
11
11
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)));
12
- const profileArg = process.argv[2] ?? 'conformance';
12
+ const filterArg = process.argv[2] ?? null;
13
13
 
14
- export function runConformance(reporter = new TestReporter(), requestedProfiles = null) {
15
- const profiles = requestedProfiles ?? (profileArg === 'conformance' ? ['core', 'extension'] : [profileArg]);
16
- for (const profile of profiles) runProfile(reporter, profile);
14
+ export function runConformance(reporter = new TestReporter(), requestedFilter = null) {
15
+ const filter = requestedFilter ?? filterArg;
16
+ const label = filter == null ? 'eyelang' : `eyelang ${filter}`;
17
+ reporter.section(`Conformance ${label}`);
18
+ for (const file of listCaseFiles(filter)) runCaseFile(reporter, file);
19
+ reporter.sectionTotal(`conformance ${label}`);
17
20
  }
18
21
 
19
- function runProfile(reporter, profile) {
20
- const casesDir = path.join(root, 'conformance', 'cases', profile);
21
- const expectedDir = path.join(root, 'conformance', 'expected', profile);
22
-
23
- reporter.section(`Conformance ${profile}`);
24
-
25
- const files = fs.readdirSync(casesDir)
22
+ function listCaseFiles(filter = null) {
23
+ const casesDir = path.join(root, 'conformance', 'cases');
24
+ return fs.readdirSync(casesDir)
26
25
  .filter((name) => name.endsWith('.pl'))
26
+ .filter((name) => filter == null || name.includes(filter) || name.slice(0, -3) === filter)
27
27
  .sort();
28
+ }
28
29
 
29
- for (const file of files) {
30
- const name = file.slice(0, -3);
31
- const label = `${profile}/${name}`;
32
- reporter.test(label, () => runCase(profile, name, file, casesDir, expectedDir));
33
- }
34
-
35
- reporter.sectionTotal(`conformance ${profile}`);
30
+ function runCaseFile(reporter, file) {
31
+ const name = file.slice(0, -3);
32
+ reporter.test(name, () => runCase(name, file));
36
33
  }
37
34
 
38
- function runCase(profile, name, file, casesDir, expectedDir) {
35
+ function runCase(name, file) {
36
+ const casesDir = path.join(root, 'conformance', 'cases');
37
+ const expectedDir = path.join(root, 'conformance', 'expected');
39
38
  const programFile = path.join(casesDir, file);
40
- const expected = path.join(expectedDir, `${name}.out`);
39
+ const expected = path.join(expectedDir, `${name}.pl`);
41
40
  const text = fs.readFileSync(programFile, 'utf8');
42
41
  const program = Program.parseSources([{ text, filename: file }], { sourceMetadata: false, markRecursive: false });
43
42
  const actual = run(program).stdout;
@@ -48,8 +47,7 @@ function runCase(profile, name, file, casesDir, expectedDir) {
48
47
 
49
48
  const expectedText = fs.readFileSync(expected, 'utf8');
50
49
  if (expectedText !== actual) {
51
- throw new Error(`output mismatch for ${profile}/${name}
52
- ${diffText(expected, actual)}`.trimEnd());
50
+ throw new Error(`output mismatch for ${name}\n${diffText(expected, actual)}`.trimEnd());
53
51
  }
54
52
  }
55
53