Skip to content

Commit

Permalink
Remove LFortran tests
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Mar 19, 2022
1 parent 11f8b4d commit de9c5e0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 613 deletions.
1 change: 0 additions & 1 deletion src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <lpython/parser/parser.h>
#include <lpython/parser/preprocessor.h>
#include <lpython/pickle.h>
#include <lpython/semantics/ast_to_asr.h>
#include <lpython/semantics/python_ast_to_asr.h>
#include <lpython/mod_to_asr.h>
#include <libasr/codegen/asr_to_llvm.h>
Expand Down
12 changes: 1 addition & 11 deletions src/lpython/fortran_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <libasr/exception.h>
#include <lpython/ast.h>
#include <libasr/asr.h>
#include <lpython/semantics/ast_to_asr.h>
#include <lpython/parser/parser.h>
#include <lpython/parser/preprocessor.h>
#include <lpython/pickle.h>
Expand Down Expand Up @@ -225,7 +224,7 @@ Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr2(
}

Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr3(
AST::TranslationUnit_t &ast, diag::Diagnostics &diagnostics)
AST::TranslationUnit_t &/*ast*/, diag::Diagnostics &/*diagnostics*/)
{
ASR::TranslationUnit_t* asr;
// AST -> ASR
Expand All @@ -236,15 +235,6 @@ Result<ASR::TranslationUnit_t*> FortranEvaluator::get_asr3(
}
symbol_table->mark_all_variables_external(al);
}
auto res = ast_to_asr(al, ast, diagnostics, symbol_table,
compiler_options.symtab_only);
if (res.ok) {
asr = res.result;
} else {
LFORTRAN_ASSERT(diagnostics.has_error())
return res.error;
}
if (!symbol_table) symbol_table = asr->m_global_scope;

return asr;
}
Expand Down
31 changes: 0 additions & 31 deletions src/lpython/tests/test_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <lpython/ast.h>
#include <libasr/asr.h>
#include <lpython/parser/parser.h>
#include <lpython/semantics/ast_to_asr.h>
#include <libasr/asr_verify.h>

namespace LFortran {
Expand All @@ -25,35 +24,5 @@ TEST_CASE("Test types") {

}

TEST_CASE("ASR Verify") {
Allocator al(4*1024);

std::string src = R"""(
program expr2
implicit none
integer :: x
x = (2+3)*5
print *, x
end program
)""";

LFortran::diag::Diagnostics diagnostics;
AST::TranslationUnit_t* ast = TRY(LFortran::parse(al, src, diagnostics));
ASR::TranslationUnit_t* asr = TRY(LFortran::ast_to_asr(al, *ast,
diagnostics));

CHECK(asr_verify(*asr)); // Passes

// Extract the variable "x" from the "x = (2+3)*5" line:
ASR::Program_t *prog = ASR::down_cast<ASR::Program_t>(asr->m_global_scope->scope["expr2"]);
ASR::Assignment_t *a = ASR::down_cast<ASR::Assignment_t>(prog->m_body[0]);
ASR::Var_t *v = ASR::down_cast<ASR::Var_t>(a->m_target);

v->m_v = &(prog->base); // Assign the wrong symbol to Var_t::m_v

// This will be caught by the verifier
CHECK_THROWS_AS(asr_verify(*asr), LFortranException);
}


} // namespace LFortran
Loading

0 comments on commit de9c5e0

Please sign in to comment.