annotate scripts/help/type.m @ 20368:7503499a252b stable

doc: Update docstrings to have one sentence summary as first line. Update scripts in audio, elfun, general, geometry, and image directories. * scripts/audio/@audioplayer/__get_properties__.m, scripts/audio/@audioplayer/audioplayer.m, scripts/audio/@audioplayer/get.m, scripts/audio/@audioplayer/isplaying.m, scripts/audio/@audioplayer/play.m, scripts/audio/@audioplayer/playblocking.m, scripts/audio/@audioplayer/set.m, scripts/audio/@audioplayer/subsasgn.m, scripts/audio/@audioplayer/subsref.m, scripts/audio/@audiorecorder/audiorecorder.m, scripts/audio/@audiorecorder/get.m, scripts/audio/@audiorecorder/getaudiodata.m, scripts/audio/@audiorecorder/getplayer.m, scripts/audio/@audiorecorder/isrecording.m, scripts/audio/@audiorecorder/play.m, scripts/audio/@audiorecorder/record.m, scripts/audio/@audiorecorder/recordblocking.m, scripts/audio/@audiorecorder/set.m, scripts/audio/@audiorecorder/stop.m, scripts/audio/@audiorecorder/subsasgn.m, scripts/audio/@audiorecorder/subsref.m, scripts/audio/lin2mu.m, scripts/audio/mu2lin.m, scripts/audio/record.m, scripts/audio/sound.m, scripts/audio/soundsc.m, scripts/audio/wavread.m, scripts/audio/wavwrite.m, scripts/elfun/cosd.m, scripts/elfun/sind.m, scripts/elfun/tand.m, scripts/general/accumarray.m, scripts/general/accumdim.m, scripts/general/bitcmp.m, scripts/general/bitget.m, scripts/general/bitset.m, scripts/general/blkdiag.m, scripts/general/cart2pol.m, scripts/general/cart2sph.m, scripts/general/cell2mat.m, scripts/general/celldisp.m, scripts/general/chop.m, scripts/general/circshift.m, scripts/general/common_size.m, scripts/general/cplxpair.m, scripts/general/cumtrapz.m, scripts/general/dblquad.m, scripts/general/deal.m, scripts/general/del2.m, scripts/general/display.m, scripts/general/divergence.m, scripts/general/fieldnames.m, scripts/general/flip.m, scripts/general/flipdim.m, scripts/general/fliplr.m, scripts/general/flipud.m, scripts/general/gradient.m, scripts/general/interp3.m, scripts/general/interpft.m, scripts/general/interpn.m, scripts/general/loadobj.m, scripts/general/logspace.m, scripts/general/methods.m, scripts/general/nargchk.m, scripts/general/narginchk.m, scripts/general/nargoutchk.m, scripts/general/nextpow2.m, scripts/general/nthargout.m, scripts/general/num2str.m, scripts/general/pol2cart.m, scripts/general/polyarea.m, scripts/general/postpad.m, scripts/general/prepad.m, scripts/general/profile.m, scripts/general/quadgk.m, scripts/general/quadl.m, scripts/general/quadv.m, scripts/general/randi.m, scripts/general/rat.m, scripts/general/repmat.m, scripts/general/rot90.m, scripts/general/rotdim.m, scripts/general/saveobj.m, scripts/general/shift.m, scripts/general/shiftdim.m, scripts/general/sortrows.m, scripts/general/sph2cart.m, scripts/general/structfun.m, scripts/general/subsindex.m, scripts/general/trapz.m, scripts/general/triplequad.m, scripts/geometry/delaunayn.m, scripts/geometry/dsearch.m, scripts/geometry/dsearchn.m, scripts/geometry/griddata.m, scripts/geometry/griddata3.m, scripts/geometry/griddatan.m, scripts/geometry/inpolygon.m, scripts/geometry/rectint.m, scripts/geometry/tsearchn.m, scripts/geometry/voronoi.m, scripts/geometry/voronoin.m, scripts/help/__unimplemented__.m, scripts/help/doc.m, scripts/help/doc_cache_create.m, scripts/help/get_first_help_sentence.m, scripts/help/help.m, scripts/help/lookfor.m, scripts/help/print_usage.m, scripts/help/type.m, scripts/help/which.m, scripts/image/autumn.m, scripts/image/bone.m, scripts/image/brighten.m, scripts/image/cmpermute.m, scripts/image/colorcube.m, scripts/image/contrast.m, scripts/image/cool.m, scripts/image/copper.m, scripts/image/cubehelix.m, scripts/image/flag.m, scripts/image/gmap40.m, scripts/image/gray.m, scripts/image/gray2ind.m, scripts/image/hot.m, scripts/image/hsv.m, scripts/image/image.m, scripts/image/imagesc.m, scripts/image/imfinfo.m, scripts/image/imformats.m, scripts/image/imread.m, scripts/image/imshow.m, scripts/image/imwrite.m, scripts/image/iscolormap.m, scripts/image/jet.m, scripts/image/lines.m, scripts/image/ntsc2rgb.m, scripts/image/ocean.m, scripts/image/pink.m, scripts/image/prism.m, scripts/image/rainbow.m, scripts/image/rgb2ntsc.m, scripts/image/spinmap.m, scripts/image/spring.m, scripts/image/summer.m, scripts/image/white.m, scripts/image/winter.m: Update docstrings to have one sentence summary as first line. Re-structure to have line lengths <= 80 chars.
author Rik <rik@octave.org>
date Sun, 03 May 2015 09:36:20 -0700
parents 4197fc428c7d
children abf85f8cbd6c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19898
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19790
diff changeset
1 ## Copyright (C) 2009-2015 Søren Hauberg
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
2 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
3 ## This file is part of Octave.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
4 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
8 ## your option) any later version.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
9 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
13 ## General Public License for more details.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
14 ##
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
18
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
19 ## -*- texinfo -*-
9724
f22bbc5d56e9 Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents: 9037
diff changeset
20 ## @deftypefn {Command} {} type @var{name} @dots{}
f22bbc5d56e9 Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents: 9037
diff changeset
21 ## @deftypefnx {Command} {} type -q @var{name} @dots{}
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
22 ## @deftypefnx {Function File} {text =} type ("@var{name}", @dots{})
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
23 ## Display the contents of @var{name} which may be a file, function (m-file),
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
24 ## variable, operator, or keyword.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
25 ##
20368
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
26 ## @code{type} normally prepends a header line describing the category of
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
27 ## @var{name} such as function or variable; The @option{-q} option suppresses
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
28 ## this behavior.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
29 ##
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
30 ## If no output variable is used the contents are displayed on screen.
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
31 ## Otherwise, a cell array of strings is returned, where each element
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
32 ## corresponds to the contents of each requested function.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
33 ## @end deftypefn
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
34
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
35 function text = type (varargin)
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
36
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
37 if (nargin == 0)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
38 print_usage ();
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
39 elseif (! iscellstr (varargin))
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
40 error ("type: input arguments must be strings");
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
41 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
42
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
43 quiet = false;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
44 idx = strcmpi (varargin, "-q") | strcmpi (varargin, "-quiet");
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
45 if (any (idx))
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
46 quiet = true;
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
47 varargin(idx) = [];
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
48 endif
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
49
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
50 if (nargout > 0)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
51 text = cell (size (varargin));
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
52 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
53
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
54 for n = 1:length (varargin)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
55 name = varargin{n};
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
56
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
57 ## Find function and get its code
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
58 txt = "";
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
59 cmd = sprintf ("exist ('%s')", name);
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
60 e = evalin ("caller", cmd);
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
61 if (e == 1)
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
62 ## Variable
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
63 cmd = sprintf ("disp (%s);", name);
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
64 desc = evalin ("caller", cmd);
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
65 if (quiet)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
66 txt = desc;
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
67 else
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
68 txt = sprintf ("%s is a variable\n%s", name, desc);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
69 endif
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
70 elseif (e == 2)
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
71 ## m-file or ordinary file
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
72 file = which (name);
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
73 if (length (file) > 2)
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
74 ext = file(end-1:end);
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
75 endif
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
76 if (isempty (file) || ! strcmpi (ext, ".m"))
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
77 ## 'name' is an ordinary file, and not a function name.
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
78 file = file_in_loadpath (name);
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
79 quiet = true;
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
80 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
81
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
82 ## Read the file
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
83 fid = fopen (file, "r");
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
84 if (fid < 0)
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
85 error ("type: couldn't open '%s' for reading", file);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
86 endif
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
87 contents = char (fread (fid).');
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
88 fclose (fid);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
89
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
90 if (quiet)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
91 txt = contents;
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
92 else
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
93 txt = sprintf ("%s is the user-defined function defined from: %s\n\n%s",
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
94 name, file, contents);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
95 endif
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
96 elseif (e == 3)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
97 txt = sprintf ("%s is a dynamically-linked function", name);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
98 elseif (e == 5)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
99 txt = sprintf ("%s is a built-in function", name);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
100 elseif (any (strcmp (__operators__ (), name)))
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
101 txt = sprintf ("%s is an operator", name);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
102 elseif (any (strcmp (__keywords__ (), name)))
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
103 txt = sprintf ("%s is a keyword", name);
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
104 else
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
105 error ("type: '%s' undefined\n", name);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
106 endif
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
107
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
108 if (nargout == 0)
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
109 disp (txt);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
110 else
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
111 text{n} = txt;
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
112 endif
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
113 endfor
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
114 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
115
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
116
12838
b584c07cd818 codesprint: Add tests for type()
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
117 %!test
b584c07cd818 codesprint: Add tests for type()
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
118 %! var = 1;
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
119 %! text = type ("var");
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
120 %! typestr = text{1}(1:17);
12838
b584c07cd818 codesprint: Add tests for type()
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
121 %! assert (typestr, "var is a variable");
8582
92d66bbd74af Make 'type X' work when X is a variable
sh@sh-t400
parents: 8575
diff changeset
122
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
123 %!test
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
124 %! text = type ("ls");
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
125 %! typestr = text{1}(1:31);
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
126 %! assert (typestr, "ls is the user-defined function");
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
127
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
128 %!test
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
129 %! text = type ("ls", "-q");
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
130 %! typestr = text{1}(1:21);
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
131 %! assert (typestr, "## Copyright (C) 2006");
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
132
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14363
diff changeset
133 %!assert (type ("amd"){1}, "amd is a dynamically-linked function")
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
134 %!assert (type ("cat"){1}, "cat is a built-in function")
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
135 %!assert (type ("+"){1}, "+ is an operator")
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
136 %!assert (type ("end"){1}, "end is a keyword")
17399
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
137
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
138 %!error type ()
a1fa416c7c4a type.m: Fix function for filenames without extension (bug #39922).
Rik <rik@octave.org>
parents: 17338
diff changeset
139 %!error <'__NO_NAME__' undefined> type ('__NO_NAME__')
19790
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
140