Skip to content

Commit

Permalink
Add testfile for tabular
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Jun 5, 2018
1 parent b792c15 commit 9f5995d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion after/plugin/puppet_tabular.vim
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if exists(':AddTabularPipeline') && g:puppet_align_classes
endfunction


" The unction is filtering definition by '$' or '=>', then applies tabular to
" The function is filtering definition by '$' or '=>', then applies tabular to
" payload and join again. Source for this taken from
" https://unix.stackexchange.com/questions/35787/indent-the-middle-of-multiple-lines
function! AlignPuppetClass(lines)
Expand Down
55 changes: 55 additions & 0 deletions tests/tabular_test.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class some::example (
# It's not possible to allign class without leading spaces/tabs. Sad but true
$the_most_longest_argument,
String $arg2,
$arg3=4,
$rsa_private_key = undef,
Type::Server::Hostname $hostname =$::hostname,
Type::Inet $intern_ip= $::intern_ip,
Optional[Type::Inet6] $primary_ip6 = defined('$::primary_ip6') ? {
true=>$::primary_ip6,
false=> undef,
},
# comment with => and $var inside
# comment with only =>
# comment with only $argument
Type::Server::Hostname $project = $::project,
Enum[
'online',
'offline',
'WIP'
] $state= $::state,
String[1] $environment = $::environment,
Optional[String[1]] $function = $::function,
Type::Server::Hostname $monitoring_queue = $::monitoring_queue,
Array[Pattern[/\A[a-z][a-z0-9_-]*\Z/]] $monitoring_checks =$::monitoring_checks,
Optional[Type::Server::Hostname] $project_network= defined('$::project_network') ? {
true => $::project_network,
false =>undef,
default=>'',
},
) {
file { '/just_example':
ensure=>'directory',
}
# Another useful case
# Breaks by <C-a>, works with => autoalignment
if $rsa_private_key != undef {
some::cool::helper { $user:
home_dir=> '/home/user',
authorized_keys =>[
convert_ssh_rsa_private_to_public_key($rsa_private_key)
],
rsa_private_key =>$rsa_private_key,
}
}
# should be changed by <C-a>, also works with => autoalignment
$somehash = {
'key1' => true,
'another_key'=> false,
}
}

0 comments on commit 9f5995d

Please sign in to comment.