t243.py

00001 # This file is Copyright 2009 Dean Hall.
00002 #
00003 # This file is part of the Python-on-a-Chip program.
00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify
00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
00006 #
00007 # Python-on-a-Chip is distributed in the hope that it will be useful,
00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
00011 # is seen in the file COPYING up one directory from this.
00012 
00013 #
00014 # System Test 243
00015 # Fix cases where string contains an embedded null
00016 #
00017 
00018 s1 = "\0"
00019 s2 = "a" + s1
00020 s3 = s2 + "a"
00021 
00022 assert s2 == "a\0"
00023 assert s3 == "a\0a"
00024 
00025 s2 = s1 + "a"
00026 s3 = s2 + "\0"
00027 
00028 assert s2 == "\0a"
00029 assert s3 == "\0a\0"
00030 
00031 s2 = "let's \0 try" + s1 + "something else\0"
00032 assert s2 == "let's \0 try\0something else\0"

Generated on Mon Oct 18 07:40:47 2010 for Python-on-a-chip by  doxygen 1.5.9