UtilTest.java revision 1470
1024N/A * The contents of this file are subject to the terms of the 1024N/A * Common Development and Distribution License (the "License"). 1024N/A * You may not use this file except in compliance with the License. 1024N/A * language governing permissions and limitations under the License. 1024N/A * When distributing Covered Code, include this CDDL HEADER in each 1024N/A * If applicable, add the following below this CDDL HEADER, with the 1024N/A * fields enclosed by brackets "[]" replaced with your own identifying 1024N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1376N/A * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 1382N/A * Portions Copyright 2012 Jens Elkner. 160N/A * Test of the methods in <code>org.opensolaris.opengrok.web.Util</code>. 160N/A // Some of the methods have different results in different locales. 160N/A // Set locale to en_US for these tests. 1024N/A {
"Newline\nshould become <br/>",
160N/A "Newline<br/>should become <br/>" },
1469N/A {
"This is a test",
"This is a test" },
1024N/A {
"Open & Grok",
"Open & Grok" },
1024N/A {
"&<>",
"&amp;&lt;&gt;" },
1185N/A // parent directories have a trailing slash in href 1185N/A // if basename is a dir (ends with file seperator), href link also 1185N/A // should work the same way with a '.' as file separator 1185N/A // suffix added to the link? 1185N/A // compact: path needs to be resolved to /xx and no link is added 1185N/A // for the virtual root directory (parent) but emitted as plain text. 1185N/A // Prefix gets just prefixed as is and not mangled wrt. path -> "//" 1185N/A // relative pathes are resolved wrt. / , so path resolves to /a/c/d 1185N/A "<a href=\"/r//a/c/\">c</a>/" +
1185N/A "<a href=\"/r//a/c/d\">d</a>",
1366N/A "",
"/",
"a",
"\t",
"a+b",
"a b",
"/a//x/yz/##/ / ?",
1366N/A "foo::bar::test.js",
"bl\u00E5b\u00E6rsyltet\u00F8y" 1366N/A // Assuming this test will not be run in a sandbox and URI's internal 1366N/A // decoder does the right thing. URI assumes UTF-8 encoding, what we 1185N/A "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, " 1185N/A +
"cur, ps_id, ret_url, d_req_time, d_req_mil, h_resp_time, " 1185N/A "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, " 1185N/A +
"cur, ps_id, ret_url, exp_url, d_req_time, d_req_mil, " 1185N/A +
"h_resp_time, h_resp_mil) \"",
1185N/A "\"(ses_id, mer_id, pass_id, \" + refCol +\" , mer_ref, amnt, " 1420N/A +
"cur, ps_id, ret_url, <span class=\"p\">exp_url, " 1185N/A +
"</span>d_req_time, d_req_mil, h_resp_time, h_resp_mil) \"" 1185N/A "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", values);",
1185N/A "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", values);",
1185N/A "\"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?<span " 1420N/A +
"class=\"p\">, ?</span>)\", values);" 1185N/A "char *config_list = NULL;",
1185N/A "char **config_list = NULL;",
1420N/A "char *<span class=\"p\">*</span>config_list = NULL;" 1185N/A "* An error occured or there is non-numeric stuff at the end",
1185N/A "* An error occurred or there is non-numeric stuff at the end",
1420N/A "* An error occur<span class=\"p\">r</span>ed or there is " 1185N/A +
"non-numeric stuff at the end" 1124N/A // Verify that we got a table. 1124N/A // Verify that the output is well-formed.