jj/tests
Yuya Nishihara 1c0bde1a2b templater: add parsing rule for lambda expression
A lambda expression will be allowed only in .map() operation. The syntax is
borrowed from Rust closure.

In Mercurial, a map operation is implemented by context substitution. For
example, 'parents % "{node}"' prints parents[i].node for each. There are two
major problems: 1. the top-level context cannot be referred from the inner map
expression. 2. context of different types inserts arbitrarily-named keywords
(e.g. a dict type inserts "{key}" and "{value}", but how we could know.)

These issues should be avoided by using explicitly named parameters.

    parents.map(|parent| parent.commit_id ++ " " ++ commit_id)
                                                    ^^^^^^^^^ global keyword

A downside is that we can't reuse template fragment in map expression. Suppose
we have -T commit_summary, -T 'parents.map(commit_summary)' doesn't work.

    # only usable as a top-level template
    'commit_summary' = 'commit_id.short() ++ " " ++ description.first_line()'

Another problem is that a lambda expression might be confused with an alias
function.

    # .map(f) doesn't work, but .map(g) does
    'f(x)' = 'x'
    'g' = '|x| x'
2023-03-18 12:04:00 +09:00
..
common Implement "config set" subcommand 2023-02-28 18:18:02 -08:00
test_abandon_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_alias.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_branch_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_cat_command.rs cli: rename print to cat 2023-01-18 10:10:02 -08:00
test_checkout.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_commit_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_commit_template.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_concurrent_operations.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_config_command.rs Implement "config set" subcommand 2023-02-28 18:18:02 -08:00
test_debug_command.rs cli: move some debug commands to new (non-hidden) support group 2023-03-17 06:50:55 -07:00
test_describe_command.rs tests: pass string instead of bytes to add_config() 2023-01-26 12:48:30 -08:00
test_diff_command.rs cli: show diff summary as two states instead of transition 2023-03-16 08:01:13 -07:00
test_diffedit_command.rs tests: make fake editor scripts initially empty 2023-01-25 21:58:38 -08:00
test_duplicate_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_edit_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_git_clone.rs cli: on clone, turn local git remote to absolute path 2022-12-07 14:14:31 +09:00
test_git_colocated.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_git_fetch.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_git_import_export.rs git: add git.auto-local-branch 2023-01-29 20:17:49 -08:00
test_git_push.rs git push: do not consider @- if @ has non-empty content or description 2023-03-05 23:50:20 +01:00
test_git_remotes.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_gitignores.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_global_opts.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_init_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_interdiff_command.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_log_command.rs cli: disallow jj diff --color-words --git 2023-03-16 08:01:13 -07:00
test_move_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_new_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_obslog_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_operations.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_rebase_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_resolve_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_restore_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_revset_output.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_show_command.rs cli: in "show" template, indent description like Git does 2023-03-04 12:10:53 +09:00
test_sparse_command.rs copyright: change from "Google LLC" to "The Jujutsu Authors" 2022-11-28 06:05:45 -10:00
test_split_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_squash_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_status_command.rs cli: append "\n" to commit description specified by -m/--message 2022-12-22 14:59:03 +09:00
test_support_command.rs cli: move some debug commands to new (non-hidden) support group 2023-03-17 06:50:55 -07:00
test_templater.rs templater: add parsing rule for lambda expression 2023-03-18 12:04:00 +09:00
test_undo.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_unsquash_command.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00
test_untrack_command.rs tests: pass string instead of bytes to add_config() 2023-01-26 12:48:30 -08:00
test_workspaces.rs cli: replace o as graph node by when using unicode graph 2023-03-12 23:21:05 -07:00