Skip to content

Replace std::cout with std::cerr in the error diagnostics handler#644

Merged
SuperFola merged 4 commits intoArkScript-lang:devfrom
Yewzir:stdout-err-swap
Feb 28, 2026
Merged

Replace std::cout with std::cerr in the error diagnostics handler#644
SuperFola merged 4 commits intoArkScript-lang:devfrom
Yewzir:stdout-err-swap

Conversation

@Yewzir
Copy link
Contributor

@Yewzir Yewzir commented Feb 24, 2026

Description

This is half of the solution for #643 and is more than workable in principle, but still without color. Regarding color, I noticed that "termcolor" is one of the additional project modules, so I'll see what that leads to. Finally, I'll review the current tests to see if any already exist that test the output flow and any coloration. If not, I'll try to implement such test(s).

Closes #643

Checklist

  • I have read the Contributor guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation if needed (on https://github.com/ArkScript-lang/website, content/docs/)
  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

This is half of the solution for ArkScript-lang#643 and is more than workable in
principle, but still without color. Regarding color, I noticed that
"termcolor" is one of the additional project modules, so I'll see what
that leads to. Finally, I'll review the current tests to see if any
already exist that test the output flow and any coloration. If not, I'll
try to implement such test(s).
@CLAassistant
Copy link

CLAassistant commented Feb 24, 2026

CLA assistant check
All committers have signed the CLA.

@SuperFola
Copy link
Member

Hi, I'm not using termcolor to produce colored output, since I switched away from it a few months back for fmtlib.

Does using the env var NOCOLOR work for your use case?

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 24, 2026

Oh yeah, you misunderstood me. No problem. ✌

The target is color, but only on STDERR. NOCOLOR sounds like a complete shutdown. But we usually enable it whenever possible. 🙂

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 24, 2026

The colored output is purely cosmetic, and I can look into that later. The most important thing is the output stream.


I still try to run all the unit tests successfully, but the most striking part of the report always looks like this:

===============================================================================
Suite Debugger
tests:   1 | 1 failed
asserts: 10 | 6 passed | 4 failed
===============================================================================
Suite Diagnostics
tests:   3 | 3 failed
asserts: 490 | 184 passed | 306 failed
===============================================================================
Suite Parser
tests:   2 | 1 failed
asserts: 66 | 32 passed | 34 failed
===============================================================================
Suite Rosetta
tests:   1 | 1 failed
asserts: 80 | 79 passed | 1 failed

Both in this branch and in the base branch. That's why I'm starting to suspect there are quite a few tests that should actually be failing, or is that a complete misunderstanding?

@SuperFola
Copy link
Member

No test should be left failing, are you on windows perhaps?

There might be edge cases with CR being added, since we compare files and outputs as strings from the compiler/vm; I thought I took care of it since it works on my own Windows 11 copy, and on the CI.

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 25, 2026

No test should be left failing, are you on windows perhaps?

Thank you, and no.

I now know there is indeed a difference between recursively cloning with the first clone command and the second command after entering a cloned repository. The latter certainly paid off.

UT starts =====================================================================
    Running test "compile without error ir/plugin"... FAILED
Unexpected exception with message:
While processing file plugin.ark, couldn't import hash: file not found

    Running test "compile without error ir/plugin"...
    Running test "output expected IR for plugin"...
    FAILED in: /Ark/tests/unittests/TestsHelper.cpp:125 - test condition: [false] @@ -1,1 +1,15 @@
-
+page_0
+ PLUGIN 0
+ PUSH_RETURN_ADDRESS L0
+ LOAD_CONST 1
+ LOAD_CONST 2
+ PUSH_RETURN_ADDRESS L1
+ LOAD_CONST 3
+ LOAD_FAST 0
+ CALL 1
+.L1:
+ EQ 0
+ BUILTIN 26
+ CALL 2
+.L0:
+ HALT 0
Function @ expected 2 arguments
Call
  ↳ (@ 5 0)
Signature
  ↳ (@ src idx)
Arguments
  → `src' (expected List), got 5 (Number)
  → `idx' (expected Number) ✓

Alternative 2:
Signature
  ↳ (@ src idx)
Arguments
  → `src' (expected String), got 5 (Number)
`idx' (expected Number) ✓

At IP: 3, PP: 0, SP: 2
DEBUG [IROptimizer] /Ark/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp(264:24) Loaded 140 rules
TRACE [Parser] process took 0.021ms
TRACE [ImportSolver] findAndReplaceImports took 0.006ms
TRACE [ImportSolver] process took 0.008ms
DEBUG [MacroProcessor] /Ark/src/arkreactor/Compiler/Macros/Processor.cpp(32:24) Processing macros...
TRACE [MacroProcessor] process took 0.003ms
TRACE [MacroProcessor] AST after processing macros
TRACE [NameResolution] process took 0.003ms
TRACE [NameResolution] AST after name resolution
TRACE [NameResolution] checkForUndefinedSymbol took 0.001ms
TRACE [ASTLowerer] process took 0.004ms
TRACE [IROptimizer] process took 0.002ms
TRACE [IRCompiler] process took 0.005ms
 32 : Spc 48 : 0   64 : @   80 : P   96 : `  112 : p
 33 : !   49 : 1   65 : A   81 : Q   97 : a  113 : q
 34 : "   50 : 2   66 : B   82 : R   98 : b  114 : r
 35 : #   51 : 3   67 : C   83 : S   99 : c  115 : s
 36 : $   52 : 4   68 : D   84 : T  100 : d  116 : t
 37 : %   53 : 5   69 : E   85 : U  101 : e  117 : u
 38 : &   54 : 6   70 : F   86 : V  102 : f  118 : v
 39 : '   55 : 7   71 : G   87 : W  103 : g  119 : w
 40 : (   56 : 8   72 : H   88 : X  104 : h  120 : x
 41 : )   57 : 9   73 : I   89 : Y  105 : i  121 : y
 42 : *   58 : :   74 : J   90 : Z  106 : j  122 : z
 43 : +   59 : ;   75 : K   91 : [  107 : k  123 : {
 44 : ,   60 : <   76 : L   92 : \  108 : l  124 : |
 45 : -   61 : =   77 : M   93 : ]  109 : m  125 : }
 46 : .   62 : >   78 : N   94 : ^  110 : n  126 : ~
 47 : /   63 : ?   79 : O   95 : _  111 : o  127 : Del
Data: ["Iron Man" "is" "Tony Stark"]
Generating callbacks
stored: Iron Man
Calling callback number 0: Iron Man
stored: is
Calling callback number 1: is
stored: Tony Stark
Calling callback number 2: Tony Stark
1
10
29
29
Generated partial functions for test_func (a b c) => (* a b c)
Expected arguments for test_func:  3, expected 3
Expected arguments for test_func1: 2, expected 2
Calling them: 6 6
Using macro foo (a b) => (+ a b): 3
Using macro constant var=12: 12
This was executed in a if macro, testing var == 12
This was executed in a if macro, testing (and true true)
Generated a function with a macro, a_func (a b) => (+ a b)
Calling (a_func 1 2): 3
Macro 'one', returns the 2nd argument given in [1 2] => 2
Macro 'one', returns the 2nd argument given in [1 3 4] => 3
Macro 'one', returns the 2nd argument given in [1 5 6 7 8] => 5
Macro 'last', returns the last argument given in [1 2] => 2
Macro 'last', returns the last argument given in [1 3 4] => 4
Macro 'last', returns the last argument given in [1 5 6 7 8] => 8
Testing macros in scopes and macro shadowing
(global) Reading macro 'test', expected 6, 6
(sub scope) Reading macro 'test', expected -4, -4
(global) Reading macro 'test', expected 6, 6
(subscope) Reading macro 'test', expected 555, 555
(subscope, undef test) Reading macro 'test', expected 6, 555
Demonstrating a threading macro
We expected calls to go like this: f1, f2, f3, f4
>>f1 hello.json
>>f2 hello.json-f1
>>f3 hello.json-f1-f2
>>f4 hello.json-f1-f2-f3
hello.json-f1-f2-f3-f4
10
5
16
8
4
2
Reached 1 in 6 iteration(s)
cannot divide by zero
FizzBuzz,1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,Fizz,22,23,Fizz,Buzz,26,Fizz,28,29,FizzBuzz,31,32,Fizz,34,Buzz,Fizz,37,38,Fizz,Buzz,41,Fizz,43,44,FizzBuzz,46,47,Fizz,49,Buzz,Fizz,52,53,Fizz,Buzz,56,Fizz,58,59,FizzBuzz,61,62,Fizz,64,Buzz,Fizz,67,68,Fizz,Buzz,71,Fizz,73,74,FizzBuzz,76,77,Fizz,79,Buzz,Fizz,82,83,Fizz,Buzz,86,Fizz,88,89,FizzBuzz,91,92,Fizz,94,Buzz,Fizz,97,98,Fizz,
Factorial 6 (with loop and acc): 720
Bob's age: 0
Setting Bob's age to 10
New age: 10
John's age, didn't change: 12
Countdown 2
Countdown 1
Countdown 0
vm - 129 ✅ in 0.254ms
Code segment 170 (length: 36)
/Ark/tests/unittests/resources/LangSuite/builtins-tests.ark
   6   0 06 00 00 39 STORE a
       1 07 00 00 3a STORE_REF b
       2 06 00 00 3b STORE c
       3 02 00 00 02 LOAD_FAST_BY_INDEX (2)
       4 02 00 00 01 LOAD_FAST_BY_INDEX (1)
       5 02 00 00 00 LOAD_FAST_BY_INDEX (0)
       6 71 2a 28 00 FUSED_MATH 42, 40, 0
       7 0b 00 00 00 RET
       8 0c 00 00 00 HALT

Version:   4.2.0
Timestamp: 1771987397
SHA256:    19290414cda62867bfc0dd0d72c2870617aef4edca40fd2a8145cbdca3a43574

Symbols table (length: 0)

Constants table (length: 1)
0) (String) test

Instruction locations table (length: 1)
 PP, IP
  0,  0 -> /Ark/tests/unittests/resources/DiagnosticsSuite/runtime/assert.ark:0

Code segment 0 (length: 20)
/Ark/tests/unittests/resources/DiagnosticsSuite/runtime/assert.ark
   1   0 0d 00 00 04 PUSH_RETURN_ADDRESS
       1 04 00 00 00 LOAD_CONST test (String)
       2 11 00 00 00 BUILTIN false
       3 55 00 20 1a CALL_BUILTIN assert, 2
       4 0c 00 00 00 HALT

builtin - 29 ✅ in 2.370ms
operators - 145 ✅ in 0.658ms
module - 2 ✅ in 0.201ms
utf8 - 28 ✅ in 0.140ms
macro - 74 ✅ in 0.286ms
list - 81 ✅ in 0.335ms
string - 35 ✅ in 0.136ms
async - 9 ✅ in 111.876ms
====================
Successes: 532 - Failures: 0

cli - 7 ✅ in 0.736ms
dict - 106 ✅ in 0.880ms
events - 10 ✅ in 0.085ms
exceptions - 3 ✅ in 0.023ms
functional - 12 ✅ in 0.070ms
io - 19 ✅ in 0.823ms
lazy - 4 ✅ in 50.304ms
list - 144 ✅ in 0.970ms
macros - 12 ✅ in 0.045ms
math - 165 ✅ in 0.722ms
random - 18 ✅ in 0.066ms
range - 27 ✅ in 0.162ms
string - 106 ✅ in 1.443ms
switch - 3 ✅ in 0.006ms
sys - 6 ✅ in 0.022ms
====================
Successes: 642 - Failures: 0

1. first
2. second
3. third

                 1                 0                 1                 1                 3                 6                15                36                91               232               603              1585              4213             11298             30537             83097            227475            625992           1730787           4805595          13393689          37458330         105089229         295673994         834086421        2358641376        6684761125       18985057351       54022715451      154000562758      439742222071     1257643249140
2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579, 2689, 2789, 3457, 3467, 3469, 4567, 4679, 4789, 5689, 12347, 12379, 12457, 12479, 12569, 12589, 12689, 13457, 13469, 13567, 13679, 13789, 15679, 23459, 23567, 23689, 23789, 25679, 34589, 34679, 123457, 123479, 124567, 124679, 125789, 134789, 145679, 234589, 235679, 235789, 245789, 345679, 345689, 1234789, 1235789, 1245689, 1456789, 12356789, 23456789
Tests run in 04.396s

Suite 'BytecodeReader': all tests passed (25 asserts in 1 tests)
Suite 'Debugger': all tests passed (10 asserts in 1 tests)
Suite 'Diagnostics': all tests passed (490 asserts in 3 tests)
Suite 'Embedding': all tests passed (56 asserts in 13 tests)
Suite 'Examples': all tests passed (18 asserts in 1 tests)
Suite 'Formatter': all tests passed (120 asserts in 2 tests)
Suite 'Lang': all tests passed (6 asserts in 2 tests)
Suite 'NameResolution': all tests passed (40 asserts in 10 tests)
Suite 'Optimizer': all tests passed (4 asserts in 1 tests)
Suite 'Parser': all tests passed (66 asserts in 2 tests)
Suite 'Repl': all tests passed (9 asserts in 2 tests)
Suite 'Rosetta': all tests passed (80 asserts in 1 tests)
Suite 'SharedLib': all tests passed (3 asserts in 2 tests)
Suite 'State': all tests passed (23 asserts in 4 tests)
Suite 'Tools': all tests passed (24 asserts in 6 tests)
Suite 'TypeChecker': all tests passed (52 asserts in 1 tests)
Suite 'Utf8': all tests passed (5 asserts in 2 tests)
Suite 'AST': all tests passed (22 asserts in 1 tests)
===============================================================================
Suite Compiler
tests:   5 | 1 failed
asserts: 101 | 99 passed | 2 failed
Completed =====================================================================

However... it's not surprising that when I address one of the first errors related to hash with ARK_BUILD_MODULES=ON and subsequently ARK_MOD_ALL=ON, the number of failing tests increases slightly again... 🥴

@SuperFola
Copy link
Member

You need to compile TestModule for the unit tests, it's a separate target ; I forget to mention it in the docs.

And I think you fixed the tests errors that might have been due to the working directory in which you start the executable, which should be the root folder of the project.

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 27, 2026

You need to compile TestModule for the unit tests, it's a separate target

I had already done that, but the problem persisted, until now. 😉


tests/benchmarks

                                     |           | 000-684ea758   | 001-d45d7ea1      | 002-abb043b4       | 003-75161de7       | 004-ad889963       | 005-57d0e0cd     | 006-c7f632ff       | 007-28999c0f       | 008-eb9ada44       | 009-d1be6b9f         | 010-eaf4ada5         | 011-eaf4ada5         | 012-66d9c291         | 013-f533ccb6
-------------------------------------+-----------+----------------+-------------------+--------------------+--------------------+--------------------+------------------+--------------------+--------------------+--------------------+----------------------+----------------------+----------------------+----------------------+----------------------
 quicksort                           | real_time | 0.153ms        | -0.008 (-5.320%)  | -0.009 (-5.828%)   | -0.009 (-6.202%)   | -0.011 (-7.496%)   | 0.038 (24.634%)  | 0.016 (10.433%)    | 0.002 (1.347%)     | -0.033 (-21.925%)  | -0.036 (-23.297%)    | -0.052 (-34.248%)    | -0.053 (-34.995%)    | -0.057 (-37.136%)    | -0.005 (-3.551%)
                                     | cpu_time  | 0.152ms        | -0.008 (-5.338%)  | -0.009 (-6.052%)   | -0.010 (-6.299%)   | -0.011 (-7.476%)   | 0.027 (17.548%)  | 0.016 (10.622%)    | 0.002 (1.498%)     | -0.033 (-21.778%)  | -0.035 (-23.128%)    | -0.052 (-34.145%)    | -0.053 (-34.875%)    | -0.056 (-37.012%)    | -0.005 (-3.274%)
 ackermann/iterations:50             | real_time | 81.292ms       | -7.924 (-9.747%)  | -12.798 (-15.743%) | -12.939 (-15.917%) | -14.163 (-17.422%) | -2.593 (-3.190%) | -12.982 (-15.969%) | -20.260 (-24.922%) | -20.030 (-24.639%) | -32.064 (-39.443%)   | -48.528 (-59.696%)   | -50.085 (-61.611%)   | -53.324 (-65.596%)   | -17.267 (-21.241%)
                                     | cpu_time  | 80.961ms       | -7.867 (-9.717%)  | -12.764 (-15.765%) | -12.980 (-16.033%) | -14.116 (-17.436%) | -2.390 (-2.952%) | -12.727 (-15.720%) | -19.986 (-24.686%) | -19.801 (-24.458%) | -31.806 (-39.285%)   | -48.225 (-59.565%)   | -49.788 (-61.496%)   | -53.027 (-65.496%)   | -16.943 (-20.927%)
 fibonacci/iterations:100            | real_time | 7.516ms        | -1.321 (-17.580%) | -1.417 (-18.855%)  | -1.392 (-18.522%)  | -1.483 (-19.727%)  | -0.083 (-1.105%) | -0.890 (-11.843%)  | -1.050 (-13.973%)  | -1.275 (-16.958%)  | -2.965 (-39.452%)    | -3.989 (-53.070%)    | -4.033 (-53.656%)    | -4.670 (-62.128%)    | -1.182 (-15.723%)
                                     | cpu_time  | 7.498ms        | -1.324 (-17.662%) | -1.421 (-18.953%)  | -1.407 (-18.758%)  | -1.484 (-19.788%)  | -0.076 (-1.010%) | -0.880 (-11.739%)  | -1.041 (-13.880%)  | -1.266 (-16.881%)  | -2.950 (-39.346%)    | -3.975 (-53.006%)    | -4.019 (-53.595%)    | -4.655 (-62.082%)    | -1.165 (-15.530%)
 man_or_boy                          | real_time | 0.015ms        | -0.000 (-1.268%)  | -0.000 (-1.284%)   | -0.000 (-2.159%)   | -0.000 (-1.401%)   | 0.001 (5.897%)   | 0.002 (11.532%)    | 0.000 (2.962%)     | 0.000 (0.419%)     | 0.015 (98.604%)      |                      |                      |                      |
                                     | cpu_time  | 0.015ms        | -0.000 (-1.286%)  | -0.000 (-1.486%)   | -0.000 (-2.271%)   | -0.000 (-1.713%)   | 0.001 (6.049%)   | 0.001 (5.628%)     | 0.000 (3.127%)     | 0.000 (0.594%)     | 0.015 (98.900%)      |                      |                      |                      |
 builtins                            | real_time |                |                   |                    |                    |                    |                  | 0.623ms            | -0.037 (-5.881%)   | -0.088 (-14.127%)  | -0.052 (-8.320%)     | -0.051 (-8.161%)     | -0.041 (-6.518%)     | -0.043 (-6.926%)     | 0.125 (20.001%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  | 0.622ms            | -0.037 (-5.949%)   | -0.088 (-14.164%)  | -0.052 (-8.312%)     | -0.051 (-8.133%)     | -0.041 (-6.519%)     | -0.043 (-6.915%)     | 0.125 (20.134%)
 binary_trees                        | real_time |                |                   |                    |                    |                    |                  |                    |                    | 3965.900ms         | -3047.714 (-76.848%) | -3072.502 (-77.473%) | -3076.197 (-77.566%) | -3132.819 (-78.994%) | -2749.180 (-69.320%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    | 3962.320ms         | -3045.334 (-76.857%) | -3069.780 (-77.474%) | -3073.659 (-77.572%) | -3130.011 (-78.994%) | -2745.710 (-69.296%)
 for_sum                             | real_time |                |                   |                    |                    |                    |                  |                    |                    | 112.960ms          | 7.131 (6.313%)       | -31.908 (-28.247%)   | -27.716 (-24.536%)   | -26.837 (-23.758%)   | 51.487 (45.580%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    | 112.823ms          | 7.199 (6.381%)       | -31.845 (-28.226%)   | -27.689 (-24.542%)   | -26.775 (-23.732%)   | 51.596 (45.732%)
 create_closure                      | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      | 0.777ms              | -0.009 (-1.116%)     |                      |
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      | 0.776ms              | -0.009 (-1.100%)     |                      |
 create_list                         | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      | 1.747ms              | -0.057 (-3.262%)     |                      |
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      | 1.744ms              | -0.057 (-3.263%)     |                      |
 create_closure/iterations:500       | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 0.739ms              | 0.395 (53.494%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 0.738ms              | 0.396 (53.634%)
 create_list/iterations:500          | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 1.719ms              | -0.067 (-3.896%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 1.716ms              | -0.064 (-3.757%)
 n_queens/iterations:50              | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 12.189ms             | 12.094 (99.217%)
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      | 12.177ms             | 12.105 (99.413%)
 create_list_with_ref/iterations:500 | real_time |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      |                      | 1.684ms
                                     | cpu_time  |                |                   |                    |                    |                    |                  |                    |                    |                    |                      |                      |                      |                      | 1.684ms

tests/repl

ArkScript REPL -- Version 4.3.0-f533ccb6 [LICENSE: Mozilla Public License 2.0] -- Built on 2026-02-27T21:35:31Z
Type "quit" to quit. Try "help" for more information
main:001> (let a 5)
          (let a 5)
main:002> (print a)

          (print a)
5
nil
main:003>
          (im^C
main:003> (let foo (fun (bar) (* bar 7))) (print (foo 7))
          (let foo (fun (bar) (* bar 7))) (print (foo 7))
49
nil
main:004> # just a comment

          # just a comment
nil
main:005> quit

tests/unittests

UT starts =====================================================================Function @ expected 2 arguments
Call
  ↳ (@ 5 0)
Signature
  ↳ (@ src idx)
Arguments
  → `src' (expected List), got 5 (Number)
  → `idx' (expected Number) ✓

Alternative 2:
Signature
  ↳ (@ src idx)
Arguments
`src' (expected String), got 5 (Number)
  → `idx' (expected Number) ✓

At IP: 3, PP: 0, SP: 2
DEBUG [IROptimizer] /home/oh/Ark/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp(264:24) Loaded 140 rules
TRACE [Parser] process took 0.010ms
TRACE [ImportSolver] findAndReplaceImports took 0.003ms
TRACE [ImportSolver] process took 0.006ms
DEBUG [MacroProcessor] /home/oh/Ark/src/arkreactor/Compiler/Macros/Processor.cpp(32:24) Processing macros...
TRACE [MacroProcessor] process took 0.003ms
TRACE [MacroProcessor] AST after processing macros
TRACE [NameResolution] process took 0.003ms
TRACE [NameResolution] AST after name resolution
TRACE [NameResolution] checkForUndefinedSymbol took 0.001ms
TRACE [ASTLowerer] process took 0.004ms
TRACE [IROptimizer] process took 0.003ms
TRACE [IRCompiler] process took 0.008ms
 32 : Spc 48 : 0   64 : @   80 : P   96 : `  112 : p
 33 : !   49 : 1   65 : A   81 : Q   97 : a  113 : q
 34 : "   50 : 2   66 : B   82 : R   98 : b  114 : r
 35 : #   51 : 3   67 : C   83 : S   99 : c  115 : s
 36 : $   52 : 4   68 : D   84 : T  100 : d  116 : t
 37 : %   53 : 5   69 : E   85 : U  101 : e  117 : u
 38 : &   54 : 6   70 : F   86 : V  102 : f  118 : v
 39 : '   55 : 7   71 : G   87 : W  103 : g  119 : w
 40 : (   56 : 8   72 : H   88 : X  104 : h  120 : x
 41 : )   57 : 9   73 : I   89 : Y  105 : i  121 : y
 42 : *   58 : :   74 : J   90 : Z  106 : j  122 : z
 43 : +   59 : ;   75 : K   91 : [  107 : k  123 : {
 44 : ,   60 : <   76 : L   92 : \  108 : l  124 : |
 45 : -   61 : =   77 : M   93 : ]  109 : m  125 : }
 46 : .   62 : >   78 : N   94 : ^  110 : n  126 : ~
 47 : /   63 : ?   79 : O   95 : _  111 : o  127 : Del
Factorial 6 (with loop and acc): 720
FizzBuzz,1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,Fizz,22,23,Fizz,Buzz,26,Fizz,28,29,FizzBuzz,31,32,Fizz,34,Buzz,Fizz,37,38,Fizz,Buzz,41,Fizz,43,44,FizzBuzz,46,47,Fizz,49,Buzz,Fizz,52,53,Fizz,Buzz,56,Fizz,58,59,FizzBuzz,61,62,Fizz,64,Buzz,Fizz,67,68,Fizz,Buzz,71,Fizz,73,74,FizzBuzz,76,77,Fizz,79,Buzz,Fizz,82,83,Fizz,Buzz,86,Fizz,88,89,FizzBuzz,91,92,Fizz,94,Buzz,Fizz,97,98,Fizz,
1
10
29
29
Generated partial functions for test_func (a b c) => (* a b c)
Expected arguments for test_func:  3, expected 3
Expected arguments for test_func1: 2, expected 2
Calling them: 6 6
Using macro foo (a b) => (+ a b): 3
Using macro constant var=12: 12
This was executed in a if macro, testing var == 12
This was executed in a if macro, testing (and true true)
Generated a function with a macro, a_func (a b) => (+ a b)
Calling (a_func 1 2): 3
Macro 'one', returns the 2nd argument given in [1 2] => 2
Macro 'one', returns the 2nd argument given in [1 3 4] => 3
Macro 'one', returns the 2nd argument given in [1 5 6 7 8] => 5
Macro 'last', returns the last argument given in [1 2] => 2
Macro 'last', returns the last argument given in [1 3 4] => 4
Macro 'last', returns the last argument given in [1 5 6 7 8] => 8
Testing macros in scopes and macro shadowing
(global) Reading macro 'test', expected 6, 6
(sub scope) Reading macro 'test', expected -4, -4
(global) Reading macro 'test', expected 6, 6
(subscope) Reading macro 'test', expected 555, 555
(subscope, undef test) Reading macro 'test', expected 6, 555
Demonstrating a threading macro
We expected calls to go like this: f1, f2, f3, f4
>>f1 hello.json
>>f2 hello.json-f1
>>f3 hello.json-f1-f2
>>f4 hello.json-f1-f2-f3
hello.json-f1-f2-f3-f4
Bob's age: 0
Setting Bob's age to 10
New age: 10
John's age, didn't change: 12
Countdown 2
Countdown 1
Countdown 0
Data: ["Iron Man" "is" "Tony Stark"]
Generating callbacks
stored: Iron Man
Calling callback number 0: Iron Man
stored: is
Calling callback number 1: is
stored: Tony Stark
Calling callback number 2: Tony Stark
10
5
16
8
4
2
Reached 1 in 6 iteration(s)
cannot divide by zero
vm - 129 ✅ in 0.189ms
Code segment 170 (length: 36)
/home/oh/Ark/tests/unittests/resources/LangSuite/builtins-tests.ark
   6   0 06 00 00 39 STORE a
       1 07 00 00 3a STORE_REF b
       2 06 00 00 3b STORE c
       3 02 00 00 02 LOAD_FAST_BY_INDEX (2)
       4 02 00 00 01 LOAD_FAST_BY_INDEX (1)
       5 02 00 00 00 LOAD_FAST_BY_INDEX (0)
       6 71 2a 28 00 FUSED_MATH 42, 40, 0
       7 0b 00 00 00 RET
       8 0c 00 00 00 HALT

Version:   4.3.0
Timestamp: 1772224920
SHA256:    da3c8e5d13b2b02fe962ae5b33a6f25514da85190c7d6c4d8c1b0167c9de6aa2

Symbols table (length: 0)

Constants table (length: 1)
0) (String) test

Instruction locations table (length: 1)
 PP, IP
  0,  0 -> /home/oh/Ark/tests/unittests/resources/DiagnosticsSuite/runtime/assert.ark:0

Code segment 0 (length: 20)
/home/oh/Ark/tests/unittests/resources/DiagnosticsSuite/runtime/assert.ark
   1   0 0d 00 00 04 PUSH_RETURN_ADDRESS
       1 04 00 00 00 LOAD_CONST test (String)
       2 11 00 00 00 BUILTIN false
       3 55 00 20 1a CALL_BUILTIN assert, 2
       4 0c 00 00 00 HALT

builtin - 29 ✅ in 2.383ms
operators - 145 ✅ in 0.390ms
module - 2 ✅ in 0.247ms
utf8 - 28 ✅ in 0.059ms
macro - 74 ✅ in 0.118ms
list - 81 ✅ in 0.220ms
string - 35 ✅ in 0.080ms
async - 9 ✅ in 109.370ms
====================
Successes: 532 - Failures: 0

cli - 7 ✅ in 0.288ms
dict - 106 ✅ in 0.499ms
events - 10 ✅ in 0.049ms
exceptions - 3 ✅ in 0.016ms
functional - 12 ✅ in 0.074ms
io - 19 ✅ in 1.917ms
lazy - 4 ✅ in 50.247ms
list - 144 ✅ in 0.608ms
macros - 12 ✅ in 0.036ms
math - 165 ✅ in 1.520ms
random - 18 ✅ in 0.061ms
range - 27 ✅ in 0.078ms
string - 106 ✅ in 0.705ms
switch - 3 ✅ in 0.004ms
sys - 6 ✅ in 0.013ms
====================
Successes: 642 - Failures: 0

                 1                 0                 1                 1                 3                 6                15                36                91               232               603              1585              4213             11298             30537             83097            227475            625992           1730787           4805595          13393689          37458330         105089229         295673994         834086421        2358641376        6684761125       18985057351       54022715451      154000562758      439742222071     1257643249140
2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579, 2689, 2789, 3457, 3467, 3469, 4567, 4679, 4789, 5689, 12347, 12379, 12457, 12479, 12569, 12589, 12689, 13457, 13469, 13567, 13679, 13789, 15679, 23459, 23567, 23689, 23789, 25679, 34589, 34679, 123457, 123479, 124567, 124679, 125789, 134789, 145679, 234589, 235679, 235789, 245789, 345679, 345689, 1234789, 1235789, 1245689, 1456789, 12356789, 23456789
1. first
2. second
3. third

Tests run in 02.713s

Suite 'BytecodeReader': all tests passed (25 asserts in 1 tests)
Suite 'Compiler': all tests passed (103 asserts in 5 tests)
Suite 'Debugger': all tests passed (10 asserts in 1 tests)
Suite 'Diagnostics': all tests passed (490 asserts in 3 tests)
Suite 'Embedding': all tests passed (56 asserts in 13 tests)
Suite 'Examples': all tests passed (18 asserts in 1 tests)
Suite 'Formatter': all tests passed (120 asserts in 2 tests)
Suite 'Lang': all tests passed (6 asserts in 2 tests)
Suite 'NameResolution': all tests passed (40 asserts in 10 tests)
Suite 'Optimizer': all tests passed (4 asserts in 1 tests)
Suite 'Parser': all tests passed (66 asserts in 2 tests)
Suite 'Repl': all tests passed (9 asserts in 2 tests)
Suite 'Rosetta': all tests passed (80 asserts in 1 tests)
Suite 'SharedLib': all tests passed (3 asserts in 2 tests)
Suite 'State': all tests passed (23 asserts in 4 tests)
Suite 'Tools': all tests passed (24 asserts in 6 tests)
Suite 'TypeChecker': all tests passed (52 asserts in 1 tests)
Suite 'Utf8': all tests passed (5 asserts in 2 tests)
Suite 'AST': all tests passed (22 asserts in 1 tests)
Completed =====================================================================

Almost now.

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 28, 2026

Honestly, I don't really get those fuzz tests. They just keep running for hours, but what's the point if they keep going forever? What do you expect me to show you?

@SuperFola
Copy link
Member

Nothing, you don't have to run those. The CI usually does it, and I run them on my server a few times a year for big releases.

There is also no need to commit the benchmark results for this kind of change, thanks for running them though!

The fuzzing job fails on the CI due to the github token permissions, but that's only for writing a comment so it's okay.

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 28, 2026

Nothing, you don't have to run those.

Say no more. Deal!

@Yewzir Yewzir marked this pull request as ready for review February 28, 2026 12:02
@SuperFola SuperFola merged commit e81d6bb into ArkScript-lang:dev Feb 28, 2026
1 check passed
@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 28, 2026

It's funny how it took me less than a minute to fix it and a little over four days to get the tests in order, but that's all behind me now. Phew! 😂 Thank you for the assistance.

@SuperFola
Copy link
Member

The tests harness can be quite tricky to use... As I've been making it and running it, it's normal to me and I don't see its quirks anymore, but if you have tips / info to add to https://arkscript-lang.dev/docs/reference/testing_arkscript/, I'm all ears!

@Yewzir
Copy link
Contributor Author

Yewzir commented Feb 28, 2026

The tests harness can be quite tricky to use... As I've been making it and running it, it's normal to me and I don't see its quirks anymore, but if you have tips / info to add to https://arkscript-lang.dev/docs/reference/testing_arkscript/, I'm all ears!

Yes, I understand. You can expect more, as I've already encountered a few things.

@Yewzir Yewzir deleted the stdout-err-swap branch February 28, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug output is not displayed on STDERR

3 participants