Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for repl #508

Merged
merged 4 commits into from
Jan 27, 2025
Merged

Tests for repl #508

merged 4 commits into from
Jan 27, 2025

Conversation

SuperFola
Copy link
Member

Description

This adds REPL tests using https://github.com/pexpect/pexpect/

Closes #487

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
  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

Copy link

github-actions bot commented Jan 25, 2025

Static analysis report

Lizard report

Listing only functions with cyclomatic complexity >= 15 or NLOC >= 100 or parameters >= 6.

Filename Start line:end line Function name Parameters NLOC CCN
src/arkscript/REPL/Utils.cpp 46:173 Ark::internal::getColorPerKeyword 0 106 22
Report about files you didn't modify in this PR
Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/VM/VM.cpp 320:1445 Ark::VM::safeRun 3 927 196
src/arkreactor/Compiler/Macros/Processor.cpp 235:608 Ark::internal::MacroProcessor::evaluate 3 350 124
src/arkreactor/Compiler/BytecodeReader.cpp 197:447 Ark::BytecodeReader::display 4 215 76
src/arkreactor/Compiler/Compiler.cpp 449:623 Ark::internal::Compiler::handleCalls 5 143 44
src/arkscript/JsonCompiler.cpp 27:257 JsonCompiler::_compile 1 198 37
include/Ark/Compiler/AST/Parser.hpp 105:194 Ark::internal::ARK_APIParser::string 0 87 32
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 160:267 Ark::internal::NameResolutionPass::visitKeyword 3 89 32
src/arkscript/main.cpp 17:336 main 2 276 30
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 120:149 Ark::internal::IROptimizer::compactEntities 3 20 28
src/arkreactor/Compiler/Macros/Processor.cpp 102:185 Ark::internal::MacroProcessor::processNode 3 61 27
src/arkreactor/Compiler/Compiler.cpp 132:234 Ark::internal::Compiler::compileExpression 5 84 27
src/arkreactor/Compiler/AST/Node.cpp 233:306 Ark::internal::Node::debugPrint 1 64 24
src/arkreactor/Compiler/AST/Parser.cpp 272:406 Ark::internal::Parser::import_ 0 108 23
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 55:158 Ark::internal::NameResolutionPass::visit 2 84 23
src/arkreactor/Compiler/Compiler.cpp 254:311 Ark::internal::Compiler::compileListInstruction 4 47 22
include/utf8.hpp 138:184 utf8::isValid 1 44 21
src/arkreactor/Compiler/AST/Optimizer.cpp 33:83 Ark::internal::Optimizer::countAndPruneDeadCode 1 42 20
src/arkreactor/Compiler/AST/Node.cpp 160:231 Ark::internal::Node::repr 0 59 18
src/arkreactor/Compiler/Macros/Executors/Function.cpp 16:88 Ark::internal::FunctionExecutor::applyMacro 2 55 17
src/arkreactor/VM/Value.cpp 67:125 Ark::Value::toString 1 46 17
include/Ark/Compiler/AST/Predicates.hpp 132:156 Ark::internal::IsSymbol::operator ( ) 1 24 16
src/arkscript/Formatter.cpp 168:224 Formatter::format 3 53 16
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 87:118 Ark::internal::IROptimizer::compactEntities 2 18 16
src/arkreactor/Compiler/Macros/Processor.cpp 690:729 Ark::internal::MacroProcessor::isConstEval 1 35 16
src/arkreactor/Compiler/NameResolution/StaticScope.cpp 67:102 Ark::internal::NamespaceScope::get 2 27 15
src/arkreactor/Exceptions.cpp 86:130 Ark::Diagnostics::makeContext 6 35 15
src/arkreactor/TypeChecker.cpp 28:85 Ark::types::displayContract 2 51 15
src/arkreactor/Exceptions.cpp 133:146 Ark::Diagnostics::helper 9 12 4
include/Ark/Exceptions.hpp 92:101 Ark::CodeError::CodeError 6 10 1

CppCheck report

Filename Line Type Description
src/arkscript/REPL/Repl.cpp 21 performance Variable 'm_keywords' is assigned in constructor body. Consider performing initialization in initialization list.
src/arkscript/REPL/Utils.cpp 33 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 35 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 37 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 39 style Consider using std::copy algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 53 style Consider using std::transform algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 55 style Consider using std::transform algorithm instead of a raw loop.
src/arkscript/REPL/Utils.cpp 64 style Consider using std::transform algorithm instead of a raw loop.
Report files about files you didn't modify in this PR
Filename Line Type Description
include/Ark/Compiler/AST/Node.hpp 35 warning Member variable 'Node::m_type' is not initialized in the constructor.
include/Ark/VM/VM.inl 351 style Variable 'c' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 26 style Variable 'value' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 45 style Variable 'value' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 61 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 147 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 172 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 192 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 218 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 238 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/IO.cpp 260 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 21 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 41 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 64 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 84 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 105 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 126 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 150 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 174 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 195 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 216 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 236 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 256 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 276 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 293 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 310 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 327 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 344 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 361 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/Mathematics.cpp 378 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/String.cpp 166 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/System.cpp 43 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/System.cpp 75 style Parameter 'n' can be declared as reference to const
src/arkreactor/Builtins/System.cpp 99 style Parameter 'n' can be declared as reference to const
src/arkreactor/Compiler/AST/BaseParser.cpp 29 style Local variable 'next' shadows outer function
src/arkreactor/Compiler/AST/Node.cpp 33 performance Function parameter 'namespace_' should be passed by const reference.
src/arkreactor/Compiler/AST/Optimizer.cpp 54 warning Either the condition 'node.constList().size()>1' is redundant or node.constList() size can be 2. Expression 'node.constList()[2]' cause access out of bounds.
src/arkreactor/Compiler/AST/Parser.cpp 158 style Local variable 'symbol' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 188 style Local variable 'symbol' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 212 style Local variable 'condition' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 255 style Local variable 'condition' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 365 style Local variable 'symbol' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 471 style Local variable 'node' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 478 style Local variable 'symbol' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 487 style Local variable 'node' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 584 style Local variable 'condition' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 692 style Local variable 'symbol' shadows outer function
src/arkreactor/Compiler/AST/Parser.cpp 761 style Local variable 'atom' shadows outer function
src/arkreactor/Compiler/BytecodeReader.cpp 331 style struct member 'Arg::kind' is never used.
src/arkreactor/Compiler/IntermediateRepresentation/Entity.cpp 22 style Local variable 'label' shadows outer function
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 11 style struct member 'EntityWithOffset::offset' is never used.
src/arkreactor/Compiler/Macros/Processor.cpp 69 warning Assert statement calls a function which may have desired side effects: 'list'.
src/arkreactor/Compiler/Macros/Processor.cpp 568 style Local variable 'ast' shadows outer function
include/Ark/Compiler/NameResolution/StaticScope.hpp 135 style Consider using std::any_of algorithm instead of a raw loop.
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 141 style Consider using std::find_if algorithm instead of a raw loop.
src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp 55 style Consider using std::any_of algorithm instead of a raw loop.
src/arkreactor/VM/State.cpp 57 style Variable 'p' can be declared as reference to const
src/arkreactor/VM/State.cpp 106 style Variable 'p' can be declared as reference to const
src/arkreactor/VM/VM.cpp 439 style Statements following 'goto' will never be executed.
src/arkreactor/VM/VM.cpp 513 style Variable 'ip' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 995 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 995 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1002 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1002 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1009 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1009 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1016 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1016 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1023 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1023 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1030 style Variable 'b' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1030 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1085 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1125 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1232 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1268 style Variable 'a' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 1487 style Variable 'ip' can be declared as pointer to const
src/arkreactor/VM/VM.cpp 358 error syntax error
src/arkreactor/VM/Value/Closure.cpp 21 style Parameter 'vm' can be declared as reference to const
src/arkreactor/VM/Value/Closure.cpp 23 style Consider using std::any_of algorithm instead of a raw loop.
src/arkscript/Formatter.cpp 170 style Local variable 'output' shadows outer function
src/arkscript/Formatter.cpp 228 style Local variable 'output' shadows outer function
src/arkscript/Formatter.cpp 396 style Local variable 'output' shadows outer function
src/arkscript/Formatter.cpp 495 style Local variable 'output' shadows outer function
src/arkscript/Formatter.cpp 515 style Local variable 'output' shadows outer function
src/arkscript/JsonCompiler.cpp 184 style Consider using std::transform algorithm instead of a raw loop.

@coveralls
Copy link

coveralls commented Jan 25, 2025

Coverage Status

coverage: 78.302% (-1.1%) from 79.433%
when pulling a9c00cb on tests-for-repl
into 40f0b6a on dev.

Copy link

github-actions bot commented Jan 25, 2025

Fuzzing report

/usr/local/bin/afl-whatsup status check tool for afl-fuzz by Michal Zalewski

Summary stats

    Fuzzers alive : 0
   Dead or remote : 1 (included in stats)
   Total run time : 5 minutes, 0 seconds
      Total execs : 36 thousands
 Cumulative speed : 123 execs/sec
    Pending items : 142 faves, 917 total
 Coverage reached : 11.81%
    Crashes saved : 0
      Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 37045 tuples (map size 192951, highest value 255, total values 286564941) in '/dev/null'.
[+] A coverage of 37045 edges were achieved out of 192960 existing (19.20%) with 928 input files.

@SuperFola SuperFola merged commit abdc173 into dev Jan 27, 2025
25 of 26 checks passed
@SuperFola SuperFola deleted the tests-for-repl branch January 27, 2025 15:04
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.

Add a REPL test
2 participants