/ features / cperl-mode-expansions.feature
cperl-mode-expansions.feature
 1  Feature: cperl-mode expansions
 2    In order to quickly and precisely mark perl variable names
 3    As an Emacs user
 4    I want to expand to them
 5  
 6    Scenario: Mark perl variable name
 7      Given I turn on cperl-mode
 8      And there is no region selected
 9      When I insert:
10      """
11      my $foo = "bar";
12      """
13      And I place the cursor after "$f"
14      And I press "C-@"
15      And I press "C-@"
16      Then the region should be:
17      """
18      $foo
19      """
20  
21    Scenario: Mark interpolated perl variable name
22      Given I turn on cperl-mode
23      And there is no region selected
24      When I insert:
25      """
26      my $foo = "something $bar here";
27      """
28      And I place the cursor after "something "
29      And I press "C-@"
30      Then the region should be:
31      """
32      $bar
33      """
34  
35    Scenario: Mark perl package name
36      Given I turn on cperl-mode
37      And there is no region selected
38      When I insert:
39      """
40      Namespace::Foo::Bar::method_call($baz);
41      """
42      And I place the cursor before "::Foo"
43      And I press "C-@"
44      And I press "C-@"
45      Then the region should be:
46      """
47      Namespace::Foo::Bar
48      """
49  
50    Scenario: Mark one perl subroutine
51      Given I turn on cperl-mode
52      And there is no region selected
53      When I insert:
54      """
55      sub foo {
56        foo_do_something;
57      }
58  
59      sub bar {
60         bar_do_something;
61      }
62  
63      sub baz {
64         baz_do_something;
65      }
66      """
67      And I place the cursor before "foo_do_something"
68      And I press "C-@"
69      And I press "C-@"
70      And I press "C-@"
71      And I press "C-@"
72      And I press "C-@"
73      Then the region should be:
74      """
75      sub foo {
76        foo_do_something;
77      }
78      """