Skip to content

Add Windows-only test for libedax initialization with non-ASCII book file paths#902

Merged
sensuikan1973 merged 10 commits into
mainfrom
copilot/add-windows-test-for-libedax
Mar 3, 2026
Merged

Add Windows-only test for libedax initialization with non-ASCII book file paths#902
sensuikan1973 merged 10 commits into
mainfrom
copilot/add-windows-test-for-libedax

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

Verifies that libedax can initialize correctly when the book file path contains non-ASCII characters — a scenario relevant to Windows users with non-Latin system locales or usernames.

Changes

  • test/edax_command_test.dart: Added a Platform.isWindows-gated test group that:
    • Creates a temp directory with a non-ASCII prefix (非ASCII_) under Directory.systemTemp
    • Copies resources/test_book.dat into it as 本.dat
    • Initializes libedax with the non-ASCII path and asserts book moves load successfully
    • Cleans up the temp directory via finally
if (Platform.isWindows)
  group('non-ASCII path (Windows only)', () {
    test('initialize with non-ASCII book file path', () {
      final tempDir = Directory.systemTemp.createTempSync('非ASCII_');
      try {
        final nonAsciiBookFile = '${tempDir.path}/本.dat';
        File(_testBookFile).copySync(nonAsciiBookFile);
        final edax = LibEdax()
          ..libedaxInitialize(['', '-book-file', nonAsciiBookFile]);
        sleep(const Duration(seconds: 1));
        edax.edaxInit();
        final moveList = edax.edaxGetBookMove();
        expect(moveList.isNotEmpty, true);
        edax.libedaxTerminate();
      } finally {
        tempDir.deleteSync(recursive: true);
      }
    });
  });
Original prompt

Implement a Windows-only test to verify that libedax can initialize using non-ASCII paths for book files. In test/edax_command_test.dart, add a new test group guarded by Platform.isWindows that:

  • Creates a temporary directory under Directory.systemTemp with a non-ASCII name.
  • Copies the existing resources/test_book.dat into that directory with a non-ASCII filename (e.g., 本.dat).
  • Calls LibEdax().libedaxInitialize(['', '-book-file', ]), then edaxInit() and edaxVersion(), and finally libedaxTerminate(), asserting no exceptions.
  • Cleans up the temporary directory afterward.
    Add necessary imports (e.g., path package) to support path joining if required. Reuse existing test fixture resources/test_book.dat; do not add new assets. Ensure the test exits early on non-Windows platforms using Platform.isWindows guard. Keep style consistent with existing tests (e.g., sleep duration before commands).

This pull request was created from Copilot chat.


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

Co-authored-by: sensuikan1973 <23427957+sensuikan1973@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Windows-only test for libedax initialization with non-ASCII paths Add Windows-only test for libedax initialization with non-ASCII book file paths Mar 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.84%. Comparing base (2f69fac) to head (f7a513a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #902      +/-   ##
==========================================
+ Coverage   82.56%   82.84%   +0.28%     
==========================================
  Files          15       15              
  Lines         780      793      +13     
==========================================
+ Hits          644      657      +13     
  Misses        136      136              
Flag Coverage Δ
macos-latest 82.59% <100.00%> (+0.29%) ⬆️
ubuntu-latest 82.47% <100.00%> (+0.29%) ⬆️
unit_test 82.84% <100.00%> (+0.28%) ⬆️
windows-latest 82.84% <100.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
test/edax_command_test.dart 99.70% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… for libedax args.

Keeps edax-reversi C code unchanged while fixing non-ASCII path handling on Windows.
@sensuikan1973 sensuikan1973 marked this pull request as ready for review March 3, 2026 14:35
@sensuikan1973 sensuikan1973 enabled auto-merge (squash) March 3, 2026 14:36
@sensuikan1973 sensuikan1973 merged commit 3283956 into main Mar 3, 2026
16 checks passed
@sensuikan1973 sensuikan1973 deleted the copilot/add-windows-test-for-libedax branch March 3, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants