Skip to content

Commit

Permalink
Merge pull request orangeduck#148 from awmorgan/fix_name
Browse files Browse the repository at this point in the history
Fix name
  • Loading branch information
orangeduck authored Nov 28, 2024
2 parents 48f7c04 + 7a6aba9 commit 960f60d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Doc.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ var Doc = Cello(Doc,

const char* name(var type) {
struct Doc* doc = type_instance(type, Doc);
if (doc->name) { return doc->name(); }
if (doc and doc->name) { return doc->name(); }
return c_str(type);
}

Expand Down
11 changes: 10 additions & 1 deletion tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,16 @@ PT_FUNC(test_type_hash) {
}

PT_FUNC(test_type_help) {
/* TODO */
/* TODO: improve test cases, but for now just verify that
they can be called without crashing
*/
try{ name(_); } catch(e) { }
try{ brief(_); } catch(e) { }
try{ description(_); } catch(e) { }
try{ definition(_); } catch(e) { }
try{ help(_); } catch(e) { }
try{ help_to(_, 0,_);} catch(e) { }
PT_ASSERT(1);
}

PT_FUNC(test_type_show) {
Expand Down

0 comments on commit 960f60d

Please sign in to comment.