mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Tweak the SQLTester --verbose and double-verbose output a bit for legibility.
FossilOrigin-Name: 46b79afaafda40cb1f920cc96600adf11e8c688184c9559a08eb86776ccf3663
This commit is contained in:
@ -17,7 +17,7 @@ package org.sqlite.jni.tester;
|
||||
Console output utility class.
|
||||
*/
|
||||
class Outer {
|
||||
public boolean verbose = false;
|
||||
public int verbosity = 0;
|
||||
|
||||
public static void out(Object val){
|
||||
System.out.print(val);
|
||||
@ -40,17 +40,21 @@ class Outer {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Outer verbose(Object... vals){
|
||||
if(verbose){
|
||||
out("VERBOSE: ");
|
||||
if(verbosity>0){
|
||||
out("VERBOSE",(verbosity>1 ? "+: " : ": "));
|
||||
outln(vals);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setVerbose(boolean b){
|
||||
verbose = b;
|
||||
public void setVerbosity(int level){
|
||||
verbosity = level;
|
||||
}
|
||||
|
||||
public boolean isVerbose(){return verbose;}
|
||||
public int getVerbosity(){
|
||||
return verbosity;
|
||||
}
|
||||
|
||||
public boolean isVerbose(){return verbosity > 0;}
|
||||
|
||||
}
|
||||
|
@ -80,26 +80,24 @@ public class SQLTester {
|
||||
private int iCurrentDb = 0;
|
||||
private final String initialDbName = "test.db";
|
||||
private TestScript currentScript;
|
||||
private int verbosity = 0;
|
||||
|
||||
public SQLTester(){
|
||||
reset();
|
||||
}
|
||||
|
||||
public void setVerbose(int level){
|
||||
verbosity = level;
|
||||
this.outer.setVerbose( level!=0 );
|
||||
public void setVerbosity(int level){
|
||||
this.outer.setVerbosity( level );
|
||||
}
|
||||
public int getVerbosity(){
|
||||
return verbosity;
|
||||
return this.outer.getVerbosity();
|
||||
}
|
||||
public boolean isVerbose(){
|
||||
return verbosity>0;
|
||||
return this.outer.isVerbose();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void verbose(Object... vals){
|
||||
if( verbosity > 0 ) outer.verbose(vals);
|
||||
outer.verbose(vals);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -406,7 +404,7 @@ public class SQLTester {
|
||||
if(a.startsWith("-")){
|
||||
final String flag = a.replaceFirst("-+","");
|
||||
if( flag.equals("verbose") ){
|
||||
++t.verbosity;
|
||||
t.setVerbosity(t.getVerbosity() + 1);
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unhandled flag: "+flag);
|
||||
}
|
||||
@ -546,7 +544,7 @@ class CloseDbCommand extends Command {
|
||||
id = t.getCurrentDbId();
|
||||
}
|
||||
t.closeDb(id);
|
||||
//t.verbose(argv[0]," db ",id);
|
||||
t.verbose(argv[0]," db ",id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -723,7 +721,7 @@ class TableResultCommand extends Command {
|
||||
res.length," row(s) but expecting ",globs.length);
|
||||
}
|
||||
for(int i = 0; i < res.length; ++i){
|
||||
final String glob = globs[i].replaceAll("\\s+"," ");
|
||||
final String glob = globs[i].replaceAll("\\s+"," ").trim();
|
||||
//t.verbose(argv[0]," <<",glob,">> vs <<",res[i],">>");
|
||||
if( jsonMode ){
|
||||
if( !glob.equals(res[i]) ){
|
||||
|
@ -82,8 +82,8 @@ class TestScript {
|
||||
return ignoreReason;
|
||||
}
|
||||
|
||||
public void setVerbose(boolean b){
|
||||
outer.setVerbose(b);
|
||||
public void setVerbosity(int level){
|
||||
outer.setVerbosity(level);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -220,7 +220,10 @@ class TestScript {
|
||||
final String[] parts = block.split("\\n", 2);
|
||||
chunk.argv = parts[0].split("\\s+");
|
||||
if( parts.length>1 && parts[1].length()>0 ){
|
||||
chunk.content = parts[1].trim();
|
||||
chunk.content = parts[1]
|
||||
/* reminder: don't trim() here. It would be easier
|
||||
for Command impls if we did but it makes debug
|
||||
output look weird. */;
|
||||
}
|
||||
rc.add( chunk );
|
||||
}
|
||||
@ -232,17 +235,17 @@ class TestScript {
|
||||
*/
|
||||
public void run(SQLTester tester) throws Exception {
|
||||
final int verbosity = tester.getVerbosity();
|
||||
this.setVerbose(verbosity>0);
|
||||
if( null==chunks ){
|
||||
outer.outln("This test contains content which forces it to be skipped.");
|
||||
}else{
|
||||
int n = 0;
|
||||
for(CommandChunk chunk : chunks){
|
||||
if(verbosity>0){
|
||||
outer.out("VERBOSE ",moduleName," #",++n," ",chunk.argv[0],
|
||||
outer.out("VERBOSE",(verbosity>1 ? "+ " : " "),moduleName,
|
||||
" #",++n," ",chunk.argv[0],
|
||||
" ",Util.argvToString(chunk.argv));
|
||||
if(verbosity>1 && null!=chunk.content){
|
||||
outer.out("\nwith content: ", chunk.content);
|
||||
outer.out("\n", chunk.content);
|
||||
}
|
||||
outer.out("\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user