= #JxnPortable\docs\programmer_examples\demos\LocalVariable_UnitTest.jxn


#function $func( param_in_$func )
   ut.assertStartsWith( "o~", param_in_$func )
   ut.assertEquals( "o~abc", global_from_file )  ! accessible in $func
   ut.assertFalse( $this.isDefined "$local_in_file" )  ! not accessible
   
   global_from_$func = "i~uvw" + ".." + param_in_$func
   $local_in_$func = "i~xyz"

   #return "from_$func: " + $local_in_$func + ".." + param_in_$func
#endfunction


ut = @JxnUnitTest()

global_from_file = "o~abc"
$local_in_file = "o~def"
ut.assertFalse( $this.isDefined "global_from_$func" )  ! not yet defined

result = $func( "o~ghi" )  ! 1st call
ut.assertEquals( "from_$func: i~xyz..o~ghi", result )
ut.assertFalse( $this.isDefined "param_in_$func" )    ! not accessible
ut.assertEquals( "i~uvw..o~ghi", global_from_$func )  ! now defined
ut.assertFalse( $this.isDefined "$local_in_$func" )   ! not accessible

$func.setDebug(3)  ! show function execution
result = $func( $local_in_file )  ! 2nd call
ut.assertEquals( "from_$func: i~xyz..o~def", result )
ut.assertEquals( "i~uvw..o~def", global_from_$func )  ! changed

ut.summary()