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

feat: add chars method for builtin str #1793

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jellllly420
Copy link

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

kclvm/runtime/src/
kclvm/runtime/src/value/
kclvm/runtime/src/builtin/
kclvm/tests/test_units/runtime/str/
test/grammar/builtins/str/

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

This PR adds a chars method for builtin str to return a list of the characters in the string.

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

Runtime test: kclvm/tests/test_units/runtime/str/
Grammar test: test/grammar/builtins/str/

@He1pa
Copy link
Contributor

He1pa commented Dec 19, 2024

Some lsp test failed about str std method. just re-run and update *.snap file

@He1pa
Copy link
Contributor

He1pa commented Dec 19, 2024

cc @zong-zhe

@@ -17,6 +17,11 @@ def checkequal(self, result, obj, methodname, *args, **kwargs):
realresult = dylib.Invoke(f"str.{methodname}", obj, *args, **kwargs)
self.assertEqual(result, realresult)

def test_chars(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

test for unicode?

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.

[Feature Request] Enhance String Handling Consistency for Unicode and ASCII in KCL
2 participants