test-ellipsize.c revision 07630cea1f3a845c09309f197ac7c4f11edd3b62
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen/***
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen This file is part of systemd.
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen Copyright 2013 Shawn Landden
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen systemd is free software; you can redistribute it and/or modify it
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen under the terms of the GNU Lesser General Public License as published by
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen the Free Software Foundation; either version 2.1 of the License, or
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen (at your option) any later version.
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen systemd is distributed in the hope that it will be useful, but
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen WITHOUT ANY WARRANTY; without even the implied warranty of
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen Lesser General Public License for more details.
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen You should have received a copy of the GNU Lesser General Public License
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen along with systemd; If not, see <http://www.gnu.org/licenses/>.
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen***/
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen
a336a7912ecb62fb9310c4f3e50dc622aea4951cKnut Anders Hatlen#include <stdio.h>
#include "def.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
static void test_one(const char *p) {
_cleanup_free_ char *t;
t = ellipsize(p, columns(), 70);
puts(t);
}
int main(int argc, char *argv[]) {
test_one(DIGITS LETTERS DIGITS LETTERS);
test_one("한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어");
test_one("-日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国日本国");
test_one("中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国-中国中国中国中国中国中国中国中国中国中国中国中国中国");
test_one("sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd sÿstëmd");
test_one("🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮🐮");
test_one("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
test_one("shórt");
return 0;
}