github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/tabulate/tabulate_git_test.go (about)

     1  package tabulate
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/lmorg/murex/lang/types"
     7  	"github.com/lmorg/murex/test"
     8  )
     9  
    10  var (
    11  	inGit = `These are common Git commands used in various situations:
    12  
    13  start a working area (see also: git help tutorial)
    14     clone      Clone a repository into a new directory
    15     init       Create an empty Git repository or reinitialize an existing one
    16  
    17  work on the current change (see also: git help everyday)
    18     add        Add file contents to the index
    19     mv         Move or rename a file, a directory, or a symlink
    20     reset      Reset current HEAD to the specified state
    21     rm         Remove files from the working tree and from the index
    22  
    23  examine the history and state (see also: git help revisions)
    24     bisect     Use binary search to find the commit that introduced a bug
    25     grep       Print lines matching a pattern
    26     log        Show commit logs
    27     show       Show various types of objects
    28     status     Show the working tree status
    29  
    30  grow, mark and tweak your common history
    31     branch     List, create, or delete branches
    32     checkout   Switch branches or restore working tree files
    33     commit     Record changes to the repository
    34     diff       Show changes between commits, commit and working tree, etc
    35     merge      Join two or more development histories together
    36     rebase     Reapply commits on top of another base tip
    37     tag        Create, list, delete or verify a tag object signed with GPG
    38  
    39  collaborate (see also: git help workflows)
    40     fetch      Download objects and refs from another repository
    41     pull       Fetch from and integrate with another repository or a local branch
    42     push       Update remote refs along with associated objects
    43  
    44  'git help -a' and 'git help -g' list available subcommands and some
    45  concept guides. See 'git help <command>' or 'git help <concept>'
    46  to read about a specific subcommand or concept.`
    47  
    48  	csvGit = `clone,Clone a repository into a new directory
    49  init,Create an empty Git repository or reinitialize an existing one
    50  add,Add file contents to the index
    51  mv,"Move or rename a file, a directory, or a symlink"
    52  reset,Reset current HEAD to the specified state
    53  rm,Remove files from the working tree and from the index
    54  bisect,Use binary search to find the commit that introduced a bug
    55  grep,Print lines matching a pattern
    56  log,Show commit logs
    57  show,Show various types of objects
    58  status,Show the working tree status
    59  branch,"List, create, or delete branches"
    60  checkout,Switch branches or restore working tree files
    61  commit,Record changes to the repository
    62  diff,"Show changes between commits, commit and working tree, etc"
    63  merge,Join two or more development histories together
    64  rebase,Reapply commits on top of another base tip
    65  tag,"Create, list, delete or verify a tag object signed with GPG"
    66  fetch,Download objects and refs from another repository
    67  pull,Fetch from and integrate with another repository or a local branch
    68  push,Update remote refs along with associated objects
    69  `
    70  
    71  	jsonGit = `{"add":"Add file contents to the index","bisect":"Use binary search to find the commit that introduced a bug","branch":"List, create, or delete branches","checkout":"Switch branches or restore working tree files","clone":"Clone a repository into a new directory","commit":"Record changes to the repository","diff":"Show changes between commits, commit and working tree, etc","fetch":"Download objects and refs from another repository","grep":"Print lines matching a pattern","init":"Create an empty Git repository or reinitialize an existing one","log":"Show commit logs","merge":"Join two or more development histories together","mv":"Move or rename a file, a directory, or a symlink","pull":"Fetch from and integrate with another repository or a local branch","push":"Update remote refs along with associated objects","rebase":"Reapply commits on top of another base tip","reset":"Reset current HEAD to the specified state","rm":"Remove files from the working tree and from the index","show":"Show various types of objects","status":"Show the working tree status","tag":"Create, list, delete or verify a tag object signed with GPG"}`
    72  )
    73  
    74  func TestTabulateGit(t *testing.T) {
    75  	test.RunMethodTest(t,
    76  		cmdTabulate, "tabulate",
    77  		inGit,
    78  		types.Generic,
    79  		[]string{},
    80  		csvGit,
    81  		nil,
    82  	)
    83  
    84  	test.RunMethodTest(t,
    85  		cmdTabulate, "tabulate",
    86  		inGit,
    87  		types.Generic,
    88  		[]string{fMap},
    89  		jsonGit,
    90  		nil,
    91  	)
    92  }