|
31 | 31 | * [How to tag slow ruby/spec tests](#how-to-tag-slow-rubyspec-tests)
|
32 | 32 | * [How to introduce a constant in specs](#how-to-introduce-a-constant-in-specs)
|
33 | 33 | * [How to add a new spec](#how-to-add-a-new-spec)
|
| 34 | + * [How to work on a new CRuby feature](#how-to-work-on-a-new-cruby-feature) |
| 35 | + * [How to prepare PR for changes in the next CRuby version](#how-to-prepare-pr-for-changes-in-the-next-cruby-version) |
| 36 | + * [How to use jt CLI tool](#how-to-use-jt-cli-tool) |
34 | 37 |
|
35 | 38 | ## How to find a Core Method implementation
|
36 | 39 |
|
@@ -1564,3 +1567,68 @@ There are the following main directories:
|
1564 | 1567 | - `spec/ruby/core` - specs for the Core Library
|
1565 | 1568 | - `spec/ruby/library` - specs for the Standard Library
|
1566 | 1569 | - `spec/ruby/language` - specs for the Ruby syntax itself
|
| 1570 | +
|
| 1571 | +## How to work on a new CRuby feature |
| 1572 | +
|
| 1573 | +When you work on a new feature/method usually you make the following steps: |
| 1574 | +
|
| 1575 | +- check a feature/method description in the Ruby documentation |
| 1576 | +- check a corresponding issue (on the Ruby bug tracker <https://bugs.ruby-lang.org>): |
| 1577 | + - a feature description |
| 1578 | + - discussion |
| 1579 | + - "Associated revisions" tab with commits and diffs (pay attention to added MRI and ruby/spec tests) |
| 1580 | +- check existing ruby/spec tests in the TruffleRuby repository |
| 1581 | +- add missing test cases |
| 1582 | +- untag ruby/spec tests |
| 1583 | +- implement the feature |
| 1584 | +- untag MRI tests and ensure they pass too |
| 1585 | +- mention in a PR description an original issue in a way it's described in the Ruby |
| 1586 | + release notes or provide a link to an original ticket (on <https://bugs.ruby-lang.org>) |
| 1587 | +
|
| 1588 | +## How to prepare PR for changes in the next CRuby version |
| 1589 | +
|
| 1590 | +When you work on a new feature that is introduced in Ruby version which TruffleRuby doesn't support yet |
| 1591 | +(e.g. TruffleRuby is compatible with Ruby 3.1 now but the feature is introduced in Ruby 3.2) there is a |
| 1592 | +problem with running proper specs locally and on CI (both internal and GitHub Actions). |
| 1593 | +
|
| 1594 | +So you should ensure that the specs for the new feature are run and passed successfully on CI and the |
| 1595 | +whole suit pass successfully as well: |
| 1596 | +
|
| 1597 | +- add specs for the new feature if they are missing (with a `ruby_version_is` guard) |
| 1598 | +- use `PRETEND_RUBY_VERSION` environment variable to run specs for the new feature |
| 1599 | +- add a file with specs for the new feature to the next list in `spec/truffleruby.next-specs` (to run them on CI) |
| 1600 | +- use `jt test :next` to run locally all the specs for the next CRuby version |
| 1601 | +
|
| 1602 | +If the new feature breaks existing behavior and some specs fail - disable them temporary (until TruffleRuby |
| 1603 | +is switched to the next CRuby version completely) with tagging as failed (use `jt tag <path-to-spec-file>`) |
| 1604 | +
|
| 1605 | +Look for additional details in [The "Running specs for Ruby 3.3 features" section of the Contributor Workflow document](workflow.md#running-specs-for-ruby-33-features). |
| 1606 | +
|
| 1607 | +## How to use jt CLI tool |
| 1608 | +
|
| 1609 | +The `jt` CLI tool has a lot of commands but there are very few basic ones that you may need to use often: |
| 1610 | +
|
| 1611 | +- `jt ruby` - run TruffleRuby REPL (`irb`) |
| 1612 | + - `jt ruby <filename>` - execute a file with Ruby source code with TruffleRuby |
| 1613 | + - `jt ruby -e '<Ruby source code>'` - execute a string of Ruby source code with TruffleRuby REPL |
| 1614 | + - `jt -q ruby --jdebug -e '<Ruby source code>'` - to launch debugger |
| 1615 | +- `jt test <path to test file>` - run ruby/spec test file |
| 1616 | + - `jt --use ruby test <path to test file>` - to use tests against current CRuby, not TruffleRuby |
| 1617 | + - `jt -u ruby test <path to test file>` - there is a short form `-u` |
| 1618 | + - `jt test <path to test file> -- --jdebug` - to launch debugger |
| 1619 | + - `jt test fast <path to test file>` - run subset of specs and tag slow test cases with tag `slow` |
| 1620 | + - `jt test :next` - run specs for features introduced in the next CRuby version, not supported by TruffleRuby currently |
| 1621 | +- `jt test mri <path to test file>` - run MRI test file |
| 1622 | + - `jt test mri <path to test file> --jdebug` - to launch debugger for MRI tests (without `--`) |
| 1623 | + - `jt test mri <path to MRI test file> -- -n <test case name>` - to run only specified UnitTest case |
| 1624 | +- `jt build` |
| 1625 | +- `jt clean` |
| 1626 | +- `jt rebuild` |
| 1627 | +- `jt sync` - to synchronize changes in Standard Library Ruby source code and apply them without rebuilding TruffleRuby |
| 1628 | +- `jt tag` - ruby/spec only |
| 1629 | +- `jt untag <path-to-file>` - (ruby/spec only) regenerate an exclude file for particular ruby/spec file (and list all the failed test cases) |
| 1630 | +- `jt retag <path-to-file>` - (MRI test only) regenerate an exclude file for particular MRI test file (and list all the failed test cases) |
| 1631 | +- `jt lint fast` - to run some linter checks (that are run on CI) locally |
| 1632 | +- `jt rubocop` - to run Ruby source code linter separately from other linter checks. |
| 1633 | + - `jt rubocop -a` - to correct safely Rubocop warnings automatically |
| 1634 | + - `jt rubocop -A` - to correct unsafely Rubocop warnings automatically |
0 commit comments