
@include test-module('_join') {
  $list: 'a' 'b' 'c' 'd' 'e';
  $list-list: ('a' 'b' 'c', 'd' 'e' 'f', 'g' 'h' 'i');

  @include test('should join a list to a string') {
    @include assert-equal(_join($list), 'abcde');
  }

  @include test('should accept a custom separator') {
    @include assert-equal(_join($list, ','), 'a,b,c,d,e');
  }

  @include test('should accept a custom separator greater than 1 character') {
    @include assert-equal(_join($list, '--'), 'a--b--c--d--e');
  }

  @include test('should default to native join() behavior if separator argument is a list') {
    @include assert-equal(_join($list, $list), 'a' 'b' 'c' 'd' 'e' 'a' 'b' 'c' 'd' 'e');
  }

  @include test('should support single-item lists') {
    @include assert-equal(_join(('a',), ','), 'a');
  }

  @include test('should return empty string for empty lists') {
    @include assert-equal(_join(()), '');

    @include assert-equal(_join((), ','), '');
  }

  $actual: _map($list-list, _join);
  $expected: ('abc' 'def' 'ghi');

  @include test('should work as iteratee for _map') {
    @include assert-equal($actual, $expected);
  }

  @include test('should be chainable') {
    @include assert-equal(_($list-list,
        _map _join,
        _reduce _str-concat,
        _concat 'jkl',
        _join ' -- '),
      'abcdefghi -- jkl');
  }
}