Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 29, 2025

This PR migrates the existing custom test framework to the busted testing framework and adds automated CI testing, providing better test organization, more detailed output, and continuous integration.

Changes Made

Test Framework Migration

  • Replaced custom test runner (test.lua) with busted framework
  • Converted test files from lib/*-tests.lua to spec/*_spec.lua format
  • Improved test organization using busted's describe() and it() structure for better readability and isolation

Test Structure Improvements

  • More granular tests: Original 13 tests expanded to 25 more focused test cases
  • Better test descriptions: Each test now has a clear, descriptive name
  • Logical grouping: Tests are organized into logical groups using describe() blocks
  • Enhanced assertions: Using busted's assertion library for better error messages

CI/CD Integration

  • Added GitHub Actions workflow that automatically runs tests on main branch and pull requests
  • Automated environment setup with Lua 5.3, luarocks, and busted installation
  • Fixed CI compilation issues by installing liblua5.3-dev package for native extension compilation
  • Consistent testing environment using Ubuntu latest for reliable CI runs

Configuration and Documentation

  • Added .busted configuration file for consistent test running
  • Updated README.md with development section including test running instructions
  • Simplified test execution: Just run busted instead of lua test.lua

Before and After

Before (custom framework):

local tests = {
    add = function()
        local c1 = complex.new(1, 2)
        local c2 = complex.new(3, 4)
        local c3 = complex.add(c1, c2)
        assert(c3.r == 4 and c3.i == 6, "Expected 4 + 6i, got "..c3.r.." + "..c3.i.."i")
    end
}

After (busted framework):

describe("Complex number operations", function()
    it("should add complex numbers correctly", function()
        local c1 = complex.new(1, 2)
        local c2 = complex.new(3, 4)
        local c3 = complex.add(c1, c2)
        assert.are.equal(4, c3.r)
        assert.are.equal(6, c3.i)
    end)
end)

All existing functionality is preserved while providing a more maintainable and professional testing setup with automated continuous integration.

Fixes #8.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 29, 2025 17:35
Co-authored-by: InDieTasten <7047377+InDieTasten@users.noreply.github.com>
…tion

Co-authored-by: InDieTasten <7047377+InDieTasten@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate tests to busted framework Migrate tests to busted framework Aug 29, 2025
Copilot AI requested a review from InDieTasten August 29, 2025 17:38
Copy link
Owner

@InDieTasten InDieTasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please add a github actions CI workflow that will run the busted tests on main and for pull requests

Co-authored-by: InDieTasten <7047377+InDieTasten@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot please add a github actions CI workflow that will run the busted tests on main and for pull requests

I've added a GitHub Actions CI workflow that will run the busted tests on main and for pull requests. The workflow installs Lua 5.3, luarocks, and busted, then runs all tests automatically. Commit: b97acba

Copilot AI changed the title Migrate tests to busted framework Migrate tests to busted framework and add CI workflow Aug 29, 2025
Copilot AI requested a review from InDieTasten August 29, 2025 18:13
Copy link
Owner

@InDieTasten InDieTasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot CI run fails:

Run sudo luarocks install busted
  sudo luarocks install busted
  shell: /usr/bin/bash -e {0}
  
Installing https://luarocks.org/busted-2.2.0-1.src.rock
Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.
Error: Process completed with exit code 1.

Co-authored-by: InDieTasten <7047377+InDieTasten@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot CI run fails:

I've fixed the CI failure by adding the liblua5.3-dev package to the workflow. The error was occurring because busted requires Lua development headers to compile its native extensions. The CI workflow now installs the development headers along with Lua and luarocks. Commit: e5ff03d

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • luarocks.org
    • Triggering command: /usr/bin/lua5.3 /usr/bin/luarocks install busted (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from InDieTasten August 29, 2025 18:28
@InDieTasten InDieTasten marked this pull request as ready for review August 29, 2025 18:31
@InDieTasten InDieTasten merged commit 6f2e78a into main Aug 29, 2025
2 checks passed
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.

Migrate tests to busted framework

2 participants