Project 8 - Built-in Unit Testing Framework (grupo 3)#8
Open
agaf2 wants to merge 4 commits into
Open
Conversation
Implements test "name" { stmts } top-level blocks, assert expr; statements,
and a --test CLI mode that runs all tests with PASS/FAIL output and a summary.
Co-authored-by: Fábio Miranda <130818362+Fpmiranda7@users.noreply.github.com>
Co-authored-by: Davi Guerreiro <114326602+DaviGGuerreiro@users.noreply.github.com>
feat: Built-in unit testing framework (Project 8)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group
This pull request adds a built-in test framework to MiniC, introducing first-class support for test blocks and assertions in the language. It enables writing
testblocks withassertstatements, running all tests via a new--testcommand-line flag, and provides type checking and runtime execution for these features. The changes span the parser, AST, type checker, interpreter, CLI, and test suite.New Language Features:
assertstatements to the language, which evaluate a boolean expression and fail at runtime if the expression is false. [1] [2] [3]testblocks as top-level items in MiniC programs, allowing users to group assertions under named tests. [1] [2] [3]Parser and AST Updates:
assertstatements andtestblocks, and updated the AST to represent these constructs. [1] [2] [3] [4] [5]assertandtest.Type Checker Enhancements:
assertstatements (requiring a boolean expression) and checks for duplicate test names. It also type-checks the bodies of all test blocks. [1] [2] [3]Interpreter and CLI Integration:
run_testsfunction, with summary output and pass/fail reporting. The CLI supports a--testmode to run all tests in a file. [1] [2] [3]Test Suite and Fixtures:
assertandtestblock behavior, including passing, failing, and multiple tests. Added a fixture MiniC file demonstrating the test framework. [1] [2]These changes collectively introduce a robust, language-integrated test framework for MiniC, improving both developer experience and code reliability.