summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorJörg Budischewski <jbu@openoffice.org>2001-05-17 08:17:03 +0000
committerJörg Budischewski <jbu@openoffice.org>2001-05-17 08:17:03 +0000
commit44043f457f1cda1ffc76556b6dd17d8a40be63eb (patch)
treecbc85e8aef0bbe4d53eb92b8005c67a4d48c411f /sal
parent26417119ff0af3ccb789e8bd74fc6312bb9df88b (diff)
#87127# tests for access functions for bootstrap values added
Diffstat (limited to 'sal')
-rwxr-xr-xsal/test/bootstrap.bat18
-rw-r--r--sal/test/makefile.mk50
-rw-r--r--sal/test/testbootstrap.cxx51
-rw-r--r--sal/test/testbootstrap.ini1
-rwxr-xr-xsal/util/sal.map5
5 files changed, 113 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
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 9a5afc04ff26..dc5365109b6a 100755
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -447,6 +447,11 @@ UDK_2_0_0 {
rtl_getUriCharClass;
rtl_uriEncode;
rtl_uriDecode;
+
+ rtl_bootstrap_get;
+ rtl_bootstrap_setIniFileName;
+ rtl_getCommandArgCount;
+ rtl_getCommandArg;
local:
*;
};