diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2001-05-17 08:17:03 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2001-05-17 08:17:03 +0000 |
commit | 44043f457f1cda1ffc76556b6dd17d8a40be63eb (patch) | |
tree | cbc85e8aef0bbe4d53eb92b8005c67a4d48c411f /sal/test | |
parent | 26417119ff0af3ccb789e8bd74fc6312bb9df88b (diff) |
#87127# tests for access functions for bootstrap values added
Diffstat (limited to 'sal/test')
-rwxr-xr-x | sal/test/bootstrap.bat | 18 | ||||
-rw-r--r-- | sal/test/makefile.mk | 50 | ||||
-rw-r--r-- | sal/test/testbootstrap.cxx | 51 | ||||
-rw-r--r-- | sal/test/testbootstrap.ini | 1 |
4 files changed, 108 insertions, 12 deletions
diff --git a/sal/test/bootstrap.bat b/sal/test/bootstrap.bat new file mode 100755 index 000000000000..d0061e596919 --- /dev/null +++ b/sal/test/bootstrap.bat @@ -0,0 +1,18 @@ +@echo off +set MYBOOTSTRAPTESTVALUE=0 +echo 1 +.\testbootstrap 1 -env:MYBOOTSTRAPTESTVALUE=1 +echo 2 +.\testbootstrap.exe file +echo 3 +.\testbootstrap 0 -env:INIFILENAME= + +echo 4 +set MYBOOTSTRAPTESTVALUE= +rem simply ignore the file .... +.\testbootstrap default -env:INIFILENAME= + +echo 5 +.\testbootstrap default -env:MYBOOTSTRAPTESTVALUE2=1 -env:INIFILENAME= + +@echo bootstrap test finished
\ No newline at end of file diff --git a/sal/test/makefile.mk b/sal/test/makefile.mk index 2af807bc3a87..15e9db4b8e58 100644 --- a/sal/test/makefile.mk +++ b/sal/test/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: sb $ $Date: 2001-05-09 12:51:08 $ +# last change: $Author: jbu $ $Date: 2001-05-17 09:14:17 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -65,18 +65,28 @@ PRJ=.. PRJNAME=sal TARGET=saltest TARGETTYPE=CUI - +LIBTARGET=NO USE_LDUMP2=TRUE #LDUMP2=LDUMP3 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk +# ------------------------------------------------------------------ +.IF "$(GUI)"=="WNT" +BOOTSTRAPSCRIPT=bootstrap.bat +BOOTSTRAPINI=testbootstrap.ini +MY_SCRIPTCAT=cat +.ELSE +BOOTSTRAPSCRIPT=bootstrap +BOOTSTRAPINI=testbootstraprc +MY_SCRIPTCAT=tr -d "\015" < +.ENDIF -# ------------------------------------------------------------------ +APP2OBJS = $(OBJ)$/testbootstrap.obj -OBJFILES= \ +APP1OBJS= \ $(OBJ)$/testprofile.obj \ $(OBJ)$/teststring.obj \ $(OBJ)$/testuuid.obj \ @@ -84,22 +94,38 @@ OBJFILES= \ $(OBJ)$/testbyteseq.obj \ $(OBJ)$/testuri.obj \ $(OBJ)$/test.obj -# $(OBJ)$/testint64.obj \ -# $(OBJ)$/testowstring.obj \ +OBJFILES= \ + $(APP1OBJS) \ + $(APP2OBJS) -APP2TARGET= test -APP2OBJS= $(OBJFILES) -APP2STDLIBS=$(SALLIB) $(TSLLIB) -# APP2DEPN= $(SLB)$/sal.lib +APP1TARGET= test +APP1STDLIBS=$(SALLIB) $(TSLLIB) + +APP2TARGET = testbootstrap +APP2STDLIBS = $(SALLIB) # --- Targets ------------------------------------------------------ +.IF "$(depend)" == "" +ALL : $(BIN)$/$(BOOTSTRAPSCRIPT) $(BIN)$/$(BOOTSTRAPINI) ALLTAR +.ELSE +ALL: ALLDEP +.ENDIF + .INCLUDE : target.mk -# --- SO2-Filter-Datei --- +$(BIN)$/$(BOOTSTRAPSCRIPT) : $(BOOTSTRAPSCRIPT) + $(MY_SCRIPTCAT) $(BOOTSTRAPSCRIPT) > $@ +.IF "$(GUI)"!="WNT" + chmod ug+x $@ +.ENDIF +$(BIN)$/$(BOOTSTRAPINI) : testbootstrap.ini + $(MY_SCRIPTCAT) testbootstrap.ini > $@ + +# --- SO2-Filter-Datei --- $(MISC)$/tsl$(UPD)$(DLLPOSTFIX).flt: @echo ------------------------------ @echo Making: $@ diff --git a/sal/test/testbootstrap.cxx b/sal/test/testbootstrap.cxx new file mode 100644 index 000000000000..f0bfe84f17e0 --- /dev/null +++ b/sal/test/testbootstrap.cxx @@ -0,0 +1,51 @@ +#include <stdio.h> + +#include <rtl/process.h> +#include <rtl/bootstrap.hxx> +#include <rtl/string.hxx> +#include <rtl/byteseq.hxx> + +#include <osl/process.h> + +using namespace ::rtl; + + +void main( int argc, char *argv[] ) +{ + sal_Int32 nCount = rtl_getCommandArgCount(); + fprintf( stdout, "rtl-commandargs (%d)" , nCount ); + for( sal_Int32 i = 0 ; i < nCount ; i ++ ) + { + OUString data; + rtl_getCommandArg( i , &(data.pData) ); + OString o = OUStringToOString( data, RTL_TEXTENCODING_ASCII_US ); + fprintf( stdout, " %s", o.getStr() ); + } + fprintf( stdout, "\n" ); + + if( nCount == 0 ) + { + printf( "usage : testbootstrap <checkedValueOfMyBootstrapValue>\n" ); + exit( 1 ); + } + + OUString name( RTL_CONSTASCII_USTRINGPARAM( "MYBOOTSTRAPTESTVALUE" )); + OUString myDefault( RTL_CONSTASCII_USTRINGPARAM( "default" )); + + OUString value; + Bootstrap::get( name, value, myDefault ); + + OSL_ASSERT( OUString::createFromAscii( argv[1] ) == value ); + + // test the default case + name = OUString( RTL_CONSTASCII_USTRINGPARAM( "no_one_has_set_this_name" ) ); + OSL_ASSERT( ! Bootstrap::get( name, value ) ); + + myDefault = OUString( RTL_CONSTASCII_USTRINGPARAM( "1" ) ); + OUString myDefault2 = OUString( RTL_CONSTASCII_USTRINGPARAM( "2" ) ); + + Bootstrap::get( name, value, myDefault ); + OSL_ASSERT( value == myDefault ); + Bootstrap::get( name, value, myDefault2 ); + OSL_ASSERT( value == myDefault2 ); +} diff --git a/sal/test/testbootstrap.ini b/sal/test/testbootstrap.ini new file mode 100644 index 000000000000..3c02875cd483 --- /dev/null +++ b/sal/test/testbootstrap.ini @@ -0,0 +1 @@ +MYBOOTSTRAPTESTVALUE=file |