diff --git a/perl/Gnome-Tomboy/s1.pl b/perl/Gnome-Tomboy/s1.pl
index 81c9bde5fa6e3fb0448fccba496e19e0bfdd4c8e..c7977be37b54e413e71371cd751230196e943576 100755
--- a/perl/Gnome-Tomboy/s1.pl
+++ b/perl/Gnome-Tomboy/s1.pl
@@ -14,19 +14,73 @@ use strict;
 
 use lib 'lib';
 
-use Tomboy::Note::Simple;
-
 use Data::Dumper;
 $Data::Dumper::Indent= 1;
 
+use Util::XML_Parser_Tree;
+
+use Tomboy::Note::Simple;
+
 die "no note filename specified" unless (@ARGV);
 
-open (FO, '>:utf8', 'do_verify.sh');
+my @tests= (
+  'process_note',
+  'test_text_accessor',
+  'test_lines_accessor',
+);
+
+my $test_num= 0;
+my $verbose= 0;
+
+my @notes= ();
 while (my $arg= shift (@ARGV))
 {
-  process_note ($arg);
+  if ($arg =~ /^-/)
+  {
+    if ($arg eq '-t') { $test_num= shift (@ARGV); }
+    else { &usage(); }
+  }
+  else
+  {
+    push (@notes, $arg);
+  }
+}
+
+my @diff_failed= ();
+my $test= $tests[$test_num];
+my %rc;
+foreach my $arg (@notes)
+{
+  print '='x90, "\n";
+  print "$test note_fnm=[$arg]\n";
+  my $rc;
+
+     if ($test eq 'process_note')        { $rc= process_note ($arg); }
+  elsif ($test eq 'test_text_accessor')  { $rc= test_text_accessor ($arg); }
+  elsif ($test eq 'test_lines_accessor') { $rc= test_lines_accessor ($arg); }
+
+  $rc{$rc}++;
+
+  print "\n";
+}
+
+if (@diff_failed)
+{
+  open (FO, '>:utf8', 'do_verify.sh');
+  print FO <<EOX;
+#!/bin/sh
+#
+# shell script generated by test script
+#
+EOX
+  print FO '# ', scalar localtime (), "\n\n";
+
+  foreach (@diff_failed) { print FO $_, "\n"; }
+  close (FO);
 }
-close (FO);
+
+print "statistics: ", scalar @diff_failed, " times 'diff' returned non-zero return codes\n";
+print "return codes ", Dumper (\%rc);
 
 exit (0);
 
@@ -34,34 +88,127 @@ sub process_note
 {
   my $note_fnm= shift;
 
-print '='x90, "\n";
-print "process_note note_fnm=[$note_fnm]\n";
+  # V1:
+  my $n= parse Tomboy::Note::Simple ($note_fnm);
 
-# V1:
-my $n= parse Tomboy::Note::Simple ($note_fnm);
+  # V2:
+  # my $n= new Tomboy::Note::Simple; $n->parse ($note_fnm);
 
-# V2:
-# my $n= new Tomboy::Note::Simple; $n->parse ($note_fnm);
+  $n->text_to_lines ();
+  # print "lines: ", Dumper ($n->{'lines'});
+  $n->parse_lines ();
+  # print "n: ", Dumper ($n);
+
+  my $saved= $n->save('tmp');
+  # print "saved=[$saved]\n";
+  perform_diff ($note_fnm, $saved);
+}
 
-$n->text_to_lines ();
-# print "lines: ", Dumper ($n->{'lines'});
-$n->parse_lines ();
-# print "n: ", Dumper ($n);
+=head2 test_text_accessor
 
-my $saved= $n->save();
+Access the text element as parse tree, convert it into string, parse that and place it back into the note.
+If all goes well, the note file should not be different.
 
-print "saved=[$saved]\n";
-my @cmd= ('diff', '-u', $note_fnm, $saved);
-print join (' ', @cmd), "\n";
-my $rc= system (@cmd);
-print "rc=[$rc]\n\n";
+=cut
 
-if ($rc != 0)
+sub test_text_accessor
 {
-  print FO join (' ', @cmd), "\n";
+  my $note_fnm= shift;
+
+  my $note= parse Tomboy::Note::Simple($note_fnm);
+  # print "note: ", Dumper ($note);
+
+  my $pt1= $note->get_text();
+  print "pt1: ", Dumper ($pt1);
+  my $xml_str= Util::XML_Parser_Tree::to_string (@$pt1);
+  print "xml_str=[$xml_str]\n";
+
+  my $pt2= Tomboy::Note::Simple::parse_string ($xml_str);
+  print "pt2: ", Dumper ($pt2);
+
+  my $rc= $note->set_text ($pt2);
+  print "set_text: rc=[$rc]\n";
+
+  my $saved= $note->save('tmp');
+
+  perform_diff ($note_fnm, $saved);
 }
 
-  $rc;
+=head2 test_lines_accessor
+
+Access the text element as parse tree, convert it into string, parse that and place it back into the note.
+If all goes well, the note file should not be different.
+
+=cut
+
+sub test_lines_accessor
+{
+  my $note_fnm= shift;
+
+  my $note= parse Tomboy::Note::Simple($note_fnm);
+  # print "note: ", Dumper ($note);
+
+  my $l1= $note->get_lines();
+  # print "l1: ", Dumper ($l1);
+
+  my $wrapped= Tomboy::Note::Simple::wrap_lines ($l1);
+  # print "wrapped=[$wrapped]\n";
+
+  my $pt1= Tomboy::Note::Simple::parse_string ($wrapped);
+  # print "pt1: ", Dumper ($pt1);
+  my @note_content= @{$pt1->[1]->[2]};
+  # print "note_content: ", Dumper (\@note_content);
+  shift (@note_content);
+  # print "note_content: ", Dumper (\@note_content);
+
+  my $xml_str= Util::XML_Parser_Tree::to_string (@note_content);
+  # print "xml_str=[$xml_str]\n";
+
+  # my @lines= split (/\n/, $xml
+
+  my $rc= $note->set_lines ($xml_str);
+  print "set_lines: rc=[$rc]\n";
+
+  my $saved= $note->save('tmp');
+
+  perform_diff ($note_fnm, $saved);
 }
 
+sub generator
+{
+  my $title= shift || 'test note '. scalar localtime();
+
+  my $note= new Tomboy::Note::Simple('title' => $title);
+  print "note: ", Dumper ($note);
+
+  $note->save(undef, 'tmp/s3-v001.note');
+
+  $note->text_to_lines();
+  $note->save(undef, 'tmp/s3-v002.note');
+
+  print "note: ", Dumper ($note);
+
+  $note->empty_text('now empty');
+  print "note: ", Dumper ($note);
+
+  $note->save(undef, 'tmp/s3-v003.note');
+}
+
+sub perform_diff
+{
+  my $note_fnm= shift;
+  my $saved= shift;
+
+  my @cmd= ('diff', '-u', $note_fnm, $saved);
+  print join (' ', @cmd), "\n";
+  my $rc= system (@cmd);
+  print "rc=[$rc]\n";
+
+  if ($rc != 0)
+  {
+    push (@diff_failed, join (' ', @cmd));
+  }
+
+  $rc;
+}