This commit is contained in:
Kacper Marzecki 2025-06-23 19:26:00 +02:00
parent 6c243439a9
commit 07d92aed97
2 changed files with 6 additions and 10 deletions

View File

@ -220,8 +220,8 @@ defmodule Tdd.Debug do
end end
trace_data = get_and_clear_trace_data() trace_data = get_and_clear_trace_data()
disable_tracing() disable_tracing()
trace_data # trace_data
|> IO.inspect() # |> IO.inspect()
binary = JSON.encode!(trace_data) binary = JSON.encode!(trace_data)
File.write("trace.json", binary) File.write("trace.json", binary)
{outcome, trace_data} {outcome, trace_data}

12
new.exs
View File

@ -2749,9 +2749,7 @@ defmodule CompilerAlgoTests do
# --- Section: Basic Subtyping --- # --- Section: Basic Subtyping ---
IO.puts("\n--- Section: Basic Subtyping ---") IO.puts("\n--- Section: Basic Subtyping ---")
Tdd.Debug.enable_tracing()
test_subtype(":foo <: atom", true, {:literal, :foo}, :atom) test_subtype(":foo <: atom", true, {:literal, :foo}, :atom)
Tdd.Debug.disable_tracing()
test_subtype("atom <: :foo", false, :atom, {:literal, :foo}) test_subtype("atom <: :foo", false, :atom, {:literal, :foo})
test_subtype(":foo <: integer", false, {:literal, :foo}, :integer) test_subtype(":foo <: integer", false, {:literal, :foo}, :integer)
test_subtype("int==5 <: integer", true, {:literal, 5}, :integer) test_subtype("int==5 <: integer", true, {:literal, 5}, :integer)
@ -2988,12 +2986,14 @@ defmodule TddCompilerRecursiveTests do
{:list_of, :integer} {:list_of, :integer}
) )
# Tdd.Debug.run(fn ->
test_subtype( test_subtype(
"list_of(supertype) is not a subtype of list_of(subtype)", "list_of(supertype) is not a subtype of list_of(subtype)",
false, false,
{:list_of, :integer}, {:list_of, :integer},
{:list_of, {:literal, 1}} {:list_of, {:literal, 1}}
) )
# end)
list_with_int = {:cons, :integer, {:literal, []}} list_with_int = {:cons, :integer, {:literal, []}}
list_of_atoms = {:list_of, :atom} list_of_atoms = {:list_of, :atom}
@ -3006,7 +3006,7 @@ defmodule TddCompilerRecursiveTests do
) )
list_with_atom = {:cons, :atom, {:literal, []}} list_with_atom = {:cons, :atom, {:literal, []}}
Tdd.Debug.run(fn -> # Tdd.Debug.run(fn ->
test_subtype( test_subtype(
"a list with a correct element type is a subtype of list_of(E)", "a list with a correct element type is a subtype of list_of(E)",
@ -3014,7 +3014,7 @@ Tdd.Debug.run(fn ->
list_with_atom, list_with_atom,
list_of_atoms list_of_atoms
) )
end) # end)
# --- Equivalence tests --- # --- Equivalence tests ---
IO.puts("\n--- Section: Equivalence ---") IO.puts("\n--- Section: Equivalence ---")
@ -3096,11 +3096,7 @@ Tdd.Debug.run(fn ->
end end
end end
# Ensure the tracing state manager is started
# Tdd.Debug.init()
Process.sleep(100) Process.sleep(100)
# To run this new test, add the following to your main test runner script:
# TddCompilerRecursiveTests.run()
TypeSpecTests.run() TypeSpecTests.run()
TddStoreTests.run() TddStoreTests.run()
TddVariableTests.run() TddVariableTests.run()