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

remove deprecated API when moon test --doc #1434

Merged

Conversation

illusory0x0
Copy link
Contributor

PS C:\illu\repo\moonbit\core>  moon test --doc
Warning: [2000]
    ╭─[C:\illu\repo\moonbit\core\buffer\buffer.mbt:33:20]
    │
 33 │ /// assert_eq!(buf.to_unchecked_string(), "Test")
    │                    ─────────┬─────────
    │                             ╰─────────── Warning (Alert deprecated): Use `Buffer::contents` to read the contents of the buffer

Copy link

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Here are some observations and potential issues from the provided git diff:

  1. Inconsistent String Representation:

    • The original code asserts that buf.to_unchecked_string() returns "Test", while the modified code asserts that buf.contents() returns b"T\x00e\x00s\x00t\x00". This suggests a significant change in how the buffer's contents are represented or accessed. If this change is intentional, it should be clearly documented, as it could break existing code that relies on the previous behavior.
  2. Potential Null Byte Issue:

    • The modified output includes null bytes (\x00) between each character (b"T\x00e\x00s\x00t\x00"). This could indicate a bug or unintended behavior, especially if the buffer is meant to store plain text. Null bytes in strings can cause issues in many contexts, such as when passing the string to functions that expect null-terminated strings.
  3. Function Name Change:

    • The function to_unchecked_string() has been replaced with contents(). If this is intentional, it should be documented, and any dependent code should be updated accordingly. If it is unintentional, this could lead to runtime errors or unexpected behavior in code that relies on the old function name.

These issues should be reviewed carefully to ensure the changes align with the intended functionality and do not introduce bugs or inconsistencies.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 4581

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 83.295%

Totals Coverage Status
Change from base Build 4551: 0.0%
Covered Lines: 4727
Relevant Lines: 5675

💛 - Coveralls

@bobzhang bobzhang enabled auto-merge (rebase) January 8, 2025 00:57
@bobzhang bobzhang disabled auto-merge January 8, 2025 01:27
@bobzhang bobzhang merged commit b7de36f into moonbitlang:main Jan 8, 2025
10 of 14 checks passed
@illusory0x0 illusory0x0 deleted the remove-warning-when-moon-test--doc branch January 8, 2025 08:40
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.

4 participants