1
1
mirror of https://github.com/tstack/lnav.git synced 2024-09-11 13:05:51 +03:00

[pretty] add some more tests and leave leading spaces alone in some cases

This commit is contained in:
Timothy Stack 2015-04-07 21:25:01 -07:00
parent a09abb7d41
commit 2dfae4f7f9
5 changed files with 71 additions and 5 deletions

View File

@ -412,7 +412,7 @@ public:
unsigned long height;
if (this->lv_window == NULL) {
height_out = vis_line_t(1);
height_out = std::max(this->lv_height, vis_line_t(1));
width_out = 0;
}
else {

View File

@ -4634,14 +4634,16 @@ int main(int argc, char *argv[])
if (lnav_data.ld_flags & LNF_HEADLESS) {
std::vector<pair<string, string> > msgs;
std::vector<pair<string, string> >::iterator msg_iter;
textview_curses *tc;
textview_curses *log_tc, *tc;
attr_line_t al;
const std::string &line = al.get_string();
bool found_error = false;
alerter::singleton().enabled(false);
lnav_data.ld_view_stack.push(&lnav_data.ld_views[LNV_LOG]);
log_tc = &lnav_data.ld_views[LNV_LOG];
log_tc->set_height(vis_line_t(24));
lnav_data.ld_view_stack.push(log_tc);
// Read all of stdin
wait_for_pipers();
rebuild_indexes(true);

View File

@ -218,8 +218,10 @@ private:
}
void write_element(const element &el) {
if (this->pp_line_length == 0 &&
(el.e_token == DT_WHITE || el.e_token == DT_LINE)) {
if (this->pp_depth > 0 && this->pp_line_length == 0 && el.e_token == DT_WHITE) {
return;
}
if (this->pp_line_length == 0 && el.e_token == DT_LINE) {
return;
}
pcre_input &pi = this->pp_scanner->get_input();

22
test/logfile_pretty.0 Normal file
View File

@ -0,0 +1,22 @@
Apr 7 00:49:42 Tim-Stacks-iMac kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en0, 1-Gigabit, Full-duplex, Symmetric flow-control, Debug [796d,2301,0de1,0300,cde1,3800]
Apr 7 05:49:53 Tim-Stacks-iMac.local GoogleSoftwareUpdateDaemon[17212]: -[KSUpdateCheckAction performAction] KSUpdateCheckAction running KSServerUpdateRequest: <KSOmahaServerUpdateRequest:0x511f30
server=<KSOmahaServer:0x510d80>
url="https://tools.google.com/service/update2"
runningFetchers=0
tickets=1
activeTickets=1
rollCallTickets=1
body=
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<o:gupdate xmlns:o="http://www.google.com/update2/request" protocol="2.0" version="KeystoneDaemon-1.2.0.7709" ismachine="1" requestid="{0DFDBCD1-5E29-4DFC-BD99-31A2397198FE}">
<o:os platform="mac" version="MacOSX" sp="10.10.2_x86_64h"></o:os>
<o:app appid="com.google.Keystone" version="1.2.0.7709" lang="en-us" installage="180" brand="GGLG">
<o:ping r="1" a="1"></o:ping>
<o:updatecheck></o:updatecheck>
</o:app>
</o:gupdate>
>
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.2 instead of 10.10.2. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 0 CarbonCore 0x00007fff8a9b3d9b ___Gestalt_SystemVersion_block_invoke + 113
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 1 libdispatch.dylib 0x00007fff8bc84c13 _dispatch_client_callout + 8

View File

@ -360,6 +360,7 @@ run_test ${lnav_test} -n \
${test_dir}/logfile_vami.0
check_output "pretty-printer is not working" <<EOF
2015-03-12T23:16:52.071:INFO:com.root:Response :
<?xml version="1.0"?>
<response>
<locale>en-US</locale>
@ -400,6 +401,45 @@ check_output "pretty-printer is not working" <<EOF
EOF
run_test ${lnav_test} -n \
-c ":goto 0" \
-c ":switch-to-view pretty" \
${test_dir}/logfile_pretty.0
check_output "pretty-printer is not working" <<EOF
Apr 7 00:49:42 Tim-Stacks-iMac kernel[0]: Ethernet [AppleBCM5701Ethernet]: Link up on en0, 1-Gigabit, Full-duplex, Symmetric flow-control, Debug [
796d,
2301,
0de1,
0300,
cde1,
3800
]
Apr 7 05:49:53 Tim-Stacks-iMac.local GoogleSoftwareUpdateDaemon[17212]: -[KSUpdateCheckAction performAction]
KSUpdateCheckAction running KSServerUpdateRequest:
<KSOmahaServerUpdateRequest:0x511f30
server=<KSOmahaServer:0x510d80>
url="https://tools.google.com/service/update2"
runningFetchers=0
tickets=1
activeTickets=1
rollCallTickets=1
body=
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<o:gupdate xmlns:o="http://www.google.com/update2/request" protocol="2.0" version="KeystoneDaemon-1.2.0.7709" ismachine="1" requestid="{0DFDBCD1-5E29-4DFC-BD99-31A2397198FE}">
<o:os platform="mac" version="MacOSX" sp="10.10.2_x86_64h"></o:os>
<o:app appid="com.google.Keystone" version="1.2.0.7709" lang="en-us" installage="180" brand="GGLG">
<o:ping r="1" a="1"></o:ping>
<o:updatecheck></o:updatecheck>
</o:app>
</o:gupdate>
>
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.2 instead of 10.10.2. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 0 CarbonCore 0x00007fff8a9b3d9b ___Gestalt_SystemVersion_block_invoke + 113
Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 1 libdispatch.dylib 0x00007fff8bc84c13 _dispatch_client_callout + 8
EOF
run_test ${lnav_test} -n \
-c ":set-min-log-level error" \
${test_dir}/logfile_access_log.0