// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Mocha from "mocha";
import * as Test_utils from "./test_utils.mjs";

function generic_basename(is_dir_sep, current_dir_name, name) {
  if (name === "") {
    return current_dir_name;
  } else {
    let _n = name.length - 1 | 0;
    while (true) {
      let n = _n;
      if (n < 0) {
        return name.substr(0, 1);
      }
      if (!is_dir_sep(name, n)) {
        let _n$1 = n;
        let p = n + 1 | 0;
        while (true) {
          let n$1 = _n$1;
          if (n$1 < 0) {
            return name.substr(0, p);
          }
          if (is_dir_sep(name, n$1)) {
            return name.substr(n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0);
          }
          _n$1 = n$1 - 1 | 0;
          continue;
        };
      }
      _n = n - 1 | 0;
      continue;
    };
  }
}

function basename(extra) {
  return generic_basename((s, i) => s[i] === "/", "", extra);
}

Mocha.describe("Inline_regression_test", () => {
  Mocha.test("basename", () => Test_utils.eq("File \"inline_regression_test.res\", line 33, characters 7-14", basename("b/c/a.b"), "a.b"));
});

export {
  generic_basename,
  basename,
}
/*  Not a pure module */
