<commit_before>#!/usr/bin/env bats

# load the rsvm
source ./rsvm.sh

# override the RSVM_DIR
export RSVM_DIR=`pwd`/test/builds

@test "'rsvm' prints the help" {
  run rsvm
  echo ${lines[0]}
  [ ${lines[0]} = "Rust Version Manager" ]
  [ ${lines[2]} = "Usage:" ]
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm help' prints the help" {
  run rsvm help
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm --help' prints the help" {
  run rsvm --help
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm -h' prints the help" {
  run rsvm -h
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm install' prints a notice that no version was defined" {
  run rsvm install
  [ ${lines[2]} = "Please define a version of rust!" ]
}

@test "'rsvm install 0.1.1.1.1' prints a notice that the format is wrong" {
  run rsvm install 0.1.1.1.1
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install v0.4' prints a notice that the format is wrong" {
  run rsvm install v0.4
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install 1' prints a notice that the format is wrong" {
  run rsvm install 1
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install 0.4' is not complaining" {
  run rsvm install 0.4 --dry
  [ ${lines[2]} = "Would install rust v0.4" ]
}

@test "'rsvm install 0.4.1' is not complaining" {
  run rsvm install 0.4.1 --dry
  [ ${lines[2]} = "Would install rust v0.4.1" ]
}

@test "'rsvm ls' will return an empty list of installed versions" {
  run rsvm ls
  [ ${lines[2]} = "Installed versions:" ]
  [ ${lines[3]} = "  - None" ]
}<commit_msg>a test for rsvm list with installed versions<commit_after>#!/usr/bin/env bats

# load the rsvm
source ./rsvm.sh

# override the RSVM_DIR
export RSVM_DIR=`pwd`/test/builds

@test "'rsvm' prints the help" {
  run rsvm
  echo ${lines[0]}
  [ ${lines[0]} = "Rust Version Manager" ]
  [ ${lines[2]} = "Usage:" ]
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm help' prints the help" {
  run rsvm help
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm --help' prints the help" {
  run rsvm --help
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm -h' prints the help" {
  run rsvm -h
  [ ${lines[3]} = "  rsvm help | --help | -h       Show this message." ]
}

@test "'rsvm install' prints a notice that no version was defined" {
  run rsvm install
  [ ${lines[2]} = "Please define a version of rust!" ]
}

@test "'rsvm install 0.1.1.1.1' prints a notice that the format is wrong" {
  run rsvm install 0.1.1.1.1
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install v0.4' prints a notice that the format is wrong" {
  run rsvm install v0.4
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install 1' prints a notice that the format is wrong" {
  run rsvm install 1
  [ ${lines[2]} = "You defined a version of rust in a wrong format!" ]
}

@test "'rsvm install 0.4' is not complaining" {
  run rsvm install 0.4 --dry
  [ ${lines[2]} = "Would install rust v0.4" ]
}

@test "'rsvm install 0.4.1' is not complaining" {
  run rsvm install 0.4.1 --dry
  [ ${lines[2]} = "Would install rust v0.4.1" ]
}

@test "'rsvm ls' will return an empty list if no versions have been installed" {
  run rsvm ls
  [ ${lines[2]} = "Installed versions:" ]
  [ ${lines[3]} = "  - None" ]
}

@test "'rsvm ls' will return the installed versions" {
  run rsvm_init_folder_structure 0.1
  run rsvm_init_folder_structure 0.5

  run rsvm ls
  [ ${lines[2]} = "Installed versions:" ]
  [ ${lines[3]} = "  - v0.1" ]
  [ ${lines[4]} = "  - v0.5" ]

  rm -rf $RSVM_DIR/v*
}
{'fraction_non_alphanumeric': 0.1643002028397566, 'fraction_numerical': 0.026115618661257608, 'mean_word_length': 2.8828740157480315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1022713', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1486, 'n_words': 519}