## Copyright (C) 2021  Brodie Gaslam
##
## This file is part of "fansi - ANSI Control Sequence Aware String Functions"
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 or 3 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## Go to <https://www.r-project.org/Licenses> for copies of the licenses.

str.0 <- c("hello world", "goodbye moon")

identical(strsplit(str.0[1], " "), strsplit_ctl(str.0[1], " "))

str.2 <- "\033[42m hello\033[m world, Goodbye Moon"

strsplit_ctl(c(str.1, "hello world", str.2), "hello")

strsplit_ctl("hello\033[31m world", "[", fixed = TRUE)

Error in strsplit_ctl("hello\033[31m world", NA_character_) : 
  Argument `split` may not contain NAs.

str.spl1 <- strsplit_ctl(rep("hello", 6), splits)

str.spl2 <- strsplit(rep("hello", 6), splits)

str.spl3 <- strsplit_ctl(rep("\033[31mhello\033[39m", 6), splits)

strsplit_ctl(str.sp14, "\n", ctl = c("all", "nl"))

Argument `x` contains a "bytes" encoded string at index [1], which is disallowed.

Error in strsplit_ctl(str.bytes, "") : 
  Argument `x` contains a "bytes" encoded string at index [1], which is disallowed.

Error in strsplit_ctl(str.2, NA) : Argument `split` may not contain NAs.

Error in strsplit_ctl(str.2, "", warn = NULL) : 
  Argument `warn` must be TRUE or FALSE.

strsplit_ctl(str.2, "", fixed = NA_integer_)

Error in strsplit_ctl(str.2, "", fixed = NA_integer_) : 
  Argument `fixed` must be TRUE or FALSE.

strsplit_ctl(str.2, "", perl = NA_integer_)

Error in strsplit_ctl(str.2, "", perl = NA_integer_) : 
  Argument `perl` must be TRUE or FALSE.

strsplit_ctl(str.2, "", useBytes = NA_integer_)

Argument `useBytes` must be TRUE or FALSE.

Error in strsplit_ctl(str.2, "", useBytes = NA_integer_) : 
  Argument `useBytes` must be TRUE or FALSE.