// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Mocha from "mocha";
import * as Js_string from "@rescript/runtime/lib/es6/Js_string.mjs";
import * as Test_utils from "./test_utils.mjs";
import * as Belt_Option from "@rescript/runtime/lib/es6/Belt_Option.mjs";
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.mjs";

Mocha.describe("Js_string_test", () => {
  Mocha.test("make", () => Test_utils.eq("File \"js_string_test.res\", line 5, characters 24-31", "null", String(null).concat("")));
  Mocha.test("fromCharCode", () => Test_utils.eq("File \"js_string_test.res\", line 6, characters 32-39", "a", String.fromCharCode(97)));
  Mocha.test("fromCharCodeMany", () => Test_utils.eq("File \"js_string_test.res\", line 7, characters 36-43", "az", String.fromCharCode(97, 122)));
  Mocha.test("fromCodePoint", () => Test_utils.eq("File \"js_string_test.res\", line 9, characters 33-40", "a", String.fromCodePoint(97)));
  Mocha.test("fromCodePointMany", () => Test_utils.eq("File \"js_string_test.res\", line 10, characters 37-44", "az", String.fromCodePoint(97, 122)));
  Mocha.test("length", () => Test_utils.eq("File \"js_string_test.res\", line 11, characters 26-33", 3, "foo".length));
  Mocha.test("get", () => Test_utils.eq("File \"js_string_test.res\", line 12, characters 23-30", "a", "foobar"[4]));
  Mocha.test("charAt", () => Test_utils.eq("File \"js_string_test.res\", line 13, characters 26-33", "a", "foobar".charAt(4)));
  Mocha.test("charCodeAt", () => Test_utils.eq("File \"js_string_test.res\", line 14, characters 30-37", 97, "foobar".charCodeAt(4)));
  Mocha.test("codePointAt", () => Test_utils.eq("File \"js_string_test.res\", line 16, characters 31-38", 97, "foobar".codePointAt(4)));
  Mocha.test("codePointAt - out of bounds", () => Test_utils.eq("File \"js_string_test.res\", line 17, characters 47-54", undefined, "foobar".codePointAt(98)));
  Mocha.test("concat", () => Test_utils.eq("File \"js_string_test.res\", line 18, characters 26-33", "foobar", "foo".concat("bar")));
  Mocha.test("concatMany", () => Test_utils.eq("File \"js_string_test.res\", line 19, characters 30-37", "foobarbaz", "foo".concat("bar", "baz")));
  Mocha.test("endsWith", () => Test_utils.eq("File \"js_string_test.res\", line 21, characters 28-35", true, "foobar".endsWith("bar")));
  Mocha.test("endsWithFrom", () => Test_utils.eq("File \"js_string_test.res\", line 22, characters 32-39", false, "foobar".endsWith("bar", 1)));
  Mocha.test("includes", () => Test_utils.eq("File \"js_string_test.res\", line 24, characters 28-35", true, "foobarbaz".includes("bar")));
  Mocha.test("includesFrom", () => Test_utils.eq("File \"js_string_test.res\", line 25, characters 32-39", false, "foobarbaz".includes("bar", 4)));
  Mocha.test("indexOf", () => Test_utils.eq("File \"js_string_test.res\", line 26, characters 27-34", 3, "foobarbaz".indexOf("bar")));
  Mocha.test("indexOfFrom", () => Test_utils.eq("File \"js_string_test.res\", line 27, characters 31-38", -1, "foobarbaz".indexOf("bar", 4)));
  Mocha.test("lastIndexOf", () => Test_utils.eq("File \"js_string_test.res\", line 28, characters 31-38", 3, "foobarbaz".lastIndexOf("bar")));
  Mocha.test("lastIndexOfFrom", () => Test_utils.eq("File \"js_string_test.res\", line 29, characters 35-42", 3, "foobarbaz".lastIndexOf("bar", 4)));
  Mocha.test("localeCompare", () => Test_utils.eq("File \"js_string_test.res\", line 30, characters 33-40", 0, "foo".localeCompare("foo")));
  Mocha.test("match", () => Test_utils.eq("File \"js_string_test.res\", line 32, characters 7-14", [
    "na",
    "na"
  ], Primitive_option.fromNull("banana".match(/na+/g))));
  Mocha.test("match - no match", () => Test_utils.eq("File \"js_string_test.res\", line 34, characters 36-43", undefined, Primitive_option.fromNull("banana".match(/nanana+/g))));
  Mocha.test("match - not found capture groups", () => Test_utils.eq("File \"js_string_test.res\", line 37, characters 6-13", [
    "hello ",
    undefined
  ], Belt_Option.map(Primitive_option.fromNull("hello word".match(/hello (world)?/)), prim => prim.slice())));
  Mocha.test("normalize", () => Test_utils.eq("File \"js_string_test.res\", line 43, characters 29-36", "foo", "foo".normalize()));
  Mocha.test("normalizeByForm", () => Test_utils.eq("File \"js_string_test.res\", line 44, characters 35-42", "foo", "foo".normalize("NFKD")));
  Mocha.test("repeat", () => Test_utils.eq("File \"js_string_test.res\", line 46, characters 26-33", "foofoofoo", "foo".repeat(3)));
  Mocha.test("replace", () => Test_utils.eq("File \"js_string_test.res\", line 47, characters 27-34", "fooBORKbaz", "foobarbaz".replace("bar", "BORK")));
  Mocha.test("replaceByRe", () => Test_utils.eq("File \"js_string_test.res\", line 49, characters 7-14", "fooBORKBORK", "foobarbaz".replace(/ba./g, "BORK")));
  Mocha.test("unsafeReplaceBy0", () => {
    let replace = (whole, offset, s) => {
      if (whole === "bar") {
        return "BORK";
      } else {
        return "DORK";
      }
    };
    Test_utils.eq("File \"js_string_test.res\", line 59, characters 7-14", "fooBORKDORK", "foobarbaz".replace(/ba./g, replace));
  });
  Mocha.test("unsafeReplaceBy1", () => {
    let replace = (whole, p1, offset, s) => {
      if (whole === "bar") {
        return "BORK";
      } else {
        return "DORK";
      }
    };
    Test_utils.eq("File \"js_string_test.res\", line 69, characters 7-14", "fooBORKDORK", "foobarbaz".replace(/ba./g, replace));
  });
  Mocha.test("unsafeReplaceBy2", () => {
    let replace = (whole, p1, p2, offset, s) => {
      if (whole === "bar") {
        return "BORK";
      } else {
        return "DORK";
      }
    };
    Test_utils.eq("File \"js_string_test.res\", line 79, characters 7-14", "fooBORKDORK", "foobarbaz".replace(/ba./g, replace));
  });
  Mocha.test("unsafeReplaceBy3", () => {
    let replace = (whole, p1, p2, p3, offset, s) => {
      if (whole === "bar") {
        return "BORK";
      } else {
        return "DORK";
      }
    };
    Test_utils.eq("File \"js_string_test.res\", line 89, characters 7-14", "fooBORKDORK", "foobarbaz".replace(/ba./g, replace));
  });
  Mocha.test("search", () => Test_utils.eq("File \"js_string_test.res\", line 91, characters 26-33", 3, "foobarbaz".search(/ba./g)));
  Mocha.test("slice", () => Test_utils.eq("File \"js_string_test.res\", line 92, characters 25-32", "bar", "foobarbaz".slice(3, 6)));
  Mocha.test("sliceToEnd", () => Test_utils.eq("File \"js_string_test.res\", line 93, characters 30-37", "barbaz", "foobarbaz".slice(3)));
  Mocha.test("split", () => Test_utils.eq("File \"js_string_test.res\", line 94, characters 25-32", [
    "foo",
    "bar",
    "baz"
  ], "foo bar baz".split(" ")));
  Mocha.test("splitAtMost", () => Test_utils.eq("File \"js_string_test.res\", line 96, characters 7-14", [
    "foo",
    "bar"
  ], "foo bar baz".split(" ", 2)));
  Mocha.test("splitByRe", () => Test_utils.eq("File \"js_string_test.res\", line 100, characters 6-13", [
    "a",
    "#",
    undefined,
    "b",
    "#",
    ":",
    "c"
  ], Js_string.splitByRe(/(#)(:)?/, "a#b#:c")));
  Mocha.test("splitByReAtMost", () => Test_utils.eq("File \"js_string_test.res\", line 107, characters 6-13", [
    "a",
    "#",
    undefined
  ], Js_string.splitByReAtMost(/(#)(:)?/, 3, "a#b#:c")));
  Mocha.test("startsWith", () => Test_utils.eq("File \"js_string_test.res\", line 113, characters 30-37", true, "foobarbaz".startsWith("foo")));
  Mocha.test("startsWithFrom", () => Test_utils.eq("File \"js_string_test.res\", line 114, characters 34-41", false, "foobarbaz".startsWith("foo", 1)));
  Mocha.test("substr", () => Test_utils.eq("File \"js_string_test.res\", line 115, characters 26-33", "barbaz", "foobarbaz".substr(3)));
  Mocha.test("substrAtMost", () => Test_utils.eq("File \"js_string_test.res\", line 117, characters 7-14", "bar", "foobarbaz".substr(3, 3)));
  Mocha.test("substring", () => Test_utils.eq("File \"js_string_test.res\", line 119, characters 29-36", "bar", "foobarbaz".substring(3, 6)));
  Mocha.test("substringToEnd", () => Test_utils.eq("File \"js_string_test.res\", line 121, characters 7-14", "barbaz", "foobarbaz".substring(3)));
  Mocha.test("toLowerCase", () => Test_utils.eq("File \"js_string_test.res\", line 123, characters 31-38", "bork", "BORK".toLowerCase()));
  Mocha.test("toLocaleLowerCase", () => Test_utils.eq("File \"js_string_test.res\", line 124, characters 37-44", "bork", "BORK".toLocaleLowerCase()));
  Mocha.test("toUpperCase", () => Test_utils.eq("File \"js_string_test.res\", line 125, characters 31-38", "FUBAR", "fubar".toUpperCase()));
  Mocha.test("toLocaleUpperCase", () => Test_utils.eq("File \"js_string_test.res\", line 126, characters 37-44", "FUBAR", "fubar".toLocaleUpperCase()));
  Mocha.test("trim", () => Test_utils.eq("File \"js_string_test.res\", line 127, characters 24-31", "foo", "  foo  ".trim()));
  Mocha.test("anchor", () => Test_utils.eq("File \"js_string_test.res\", line 129, characters 26-33", "<a name=\"bar\">foo</a>", "foo".anchor("bar")));
  Mocha.test("link", () => Test_utils.eq("File \"js_string_test.res\", line 132, characters 6-13", "<a href=\"https://reason.ml\">foo</a>", "foo".link("https://reason.ml")));
  Mocha.test("File \"js_string_test.res\", line 137, characters 7-14", () => Test_utils.ok("File \"js_string_test.res\", line 137, characters 25-32", "ab".includes("a")));
});

/*  Not a pure module */
