--- a/inst/getfields.m
+++ b/inst/getfields.m
@@ -36,4 +36,23 @@
 
 endfunction
 
-%!assert (getfields (struct ('key', 'value'), 'key'), 'value');
+%!assert (getfields (struct ("key", "value"), "key"), "value");
+
+%!shared s, x, y, z, oo
+%! s = struct ("hello", 1, "world", 2);
+%!assert (getfields (s, "hello"), s.hello);
+%!assert (getfields (s, "world"), s.world);
+%!
+%! x = 2;
+%! y = 3;
+%! z = "foo";
+%! s = tars (x, y, z);
+%!assert (nthargout (1:3, @getfields, s, "x" , "y" ,"z"), {x y z});
+%!assert (nthargout (1:3, @getfields, s, "x" , "z" ,"z"), {x z z});
+%!
+%!fail ('getfields (s, "foo")')
+
+%!xtest
+%! oo.f0 = 1;
+%! oo = setfield (oo, {1, 2}, "fd", {3}, "b", 6);
+%! assert (getfields (oo, {1, 2}, "fd", {3}, "b"), 6);