~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to test/scaladoc/run/groups.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import scala.tools.nsc.doc.model._
 
2
import scala.tools.partest.ScaladocModelTest
 
3
 
 
4
object Test extends ScaladocModelTest {
 
5
 
 
6
  override def code = """
 
7
      package test.scaladoc {
 
8
 
 
9
        /** @groupname Z From owner chain */
 
10
        package object `groups`
 
11
 
 
12
        package groups {
 
13
          /**
 
14
           * The trait A
 
15
           * @groupdesc A Group A is the group that contains functions starting with f
 
16
           * For example:
 
17
           * {{{
 
18
           *    this is an example
 
19
           * }}}
 
20
           * @groupdesc B Group B is the group that contains functions starting with b
 
21
           * @groupname B Group B has a nice new name and a high priority
 
22
           * @groupprio B -10
 
23
           * @group Traits
 
24
           * @note This is a note
 
25
           */
 
26
          trait A {
 
27
            /** foo description
 
28
             *  @group A */
 
29
            def foo = 1
 
30
 
 
31
            /** bar description
 
32
             *  @group B */
 
33
            def bar = 2
 
34
          }
 
35
 
 
36
          /** The trait B
 
37
           *  @group Traits
 
38
           *  @groupdesc C Group C is introduced by B
 
39
           */
 
40
          trait B {
 
41
            /** baz descriptopn
 
42
             *  @group C */
 
43
            def baz = 3
 
44
          }
 
45
 
 
46
          /** The class C which inherits from both A and B
 
47
           *  @group Classes
 
48
           *  @groupdesc B Look ma, I'm overriding group descriptions!!!
 
49
           *  @groupname B And names
 
50
           */
 
51
          class C extends A with B {
 
52
            /** Oh noes, I lost my group -- or did I?!? */
 
53
            override def baz = 4
 
54
          }
 
55
        }
 
56
      }
 
57
  """
 
58
 
 
59
  // no need for special settings
 
60
  def scaladocSettings = "-feature"
 
61
 
 
62
  def testModel(rootPackage: Package) = {
 
63
    // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
 
64
    import access._
 
65
 
 
66
    // just need to check the member exists, access methods will throw an error if there's a problem
 
67
    val base = rootPackage._package("test")._package("scaladoc")._package("groups")
 
68
 
 
69
    def checkGroup(mbr: MemberEntity, grp: String) =
 
70
      assert(mbr.group == grp, "Incorrect group for " + mbr.qualifiedName + ": " + mbr.group + " instead of " + grp)
 
71
 
 
72
    def checkGroupDesc(dtpl: DocTemplateEntity, grp: String, grpDesc: String) = {
 
73
      assert(dtpl.groupDescription(grp).isDefined,
 
74
             "Group description for " + grp + " not defined in " + dtpl.qualifiedName)
 
75
      assert(extractCommentText(dtpl.groupDescription(grp).get).contains(grpDesc),
 
76
             "Group description for " + grp + " in " + dtpl.qualifiedName + " does not contain \"" + grpDesc + "\": \"" +
 
77
             extractCommentText(dtpl.groupDescription(grp).get) + "\"")
 
78
    }
 
79
 
 
80
    def checkGroupName(dtpl: DocTemplateEntity, grp: String, grpName: String) =
 
81
      // TODO: See why we need trim here, we already do trimming in the CommentFactory
 
82
      assert(dtpl.groupName(grp) == grpName,
 
83
             "Group name for " + grp + " in " + dtpl.qualifiedName + " does not equal \"" + grpName + "\": \"" + dtpl.groupName(grp) + "\"")
 
84
 
 
85
    def checkGroupPrio(dtpl: DocTemplateEntity, grp: String, grpPrio: Int) =
 
86
      assert(dtpl.groupPriority(grp) == grpPrio,
 
87
             "Group priority for " + grp + " in " + dtpl.qualifiedName + " does not equal " + grpPrio + ": " + dtpl.groupPriority(grp))
 
88
 
 
89
 
 
90
    val A = base._trait("A")
 
91
    val B = base._trait("B")
 
92
    val C = base._class("C")
 
93
    checkGroup(A, "Traits")
 
94
    checkGroup(B, "Traits")
 
95
    checkGroup(C, "Classes")
 
96
    checkGroup(A._method("foo"), "A")
 
97
    checkGroup(A._method("bar"), "B")
 
98
    checkGroup(B._method("baz"), "C")
 
99
    checkGroup(C._method("foo"), "A")
 
100
    checkGroup(C._method("bar"), "B")
 
101
    checkGroup(C._method("baz"), "C")
 
102
 
 
103
    checkGroupDesc(A, "A", "Group A is the group that contains functions starting with f")
 
104
    checkGroupName(A, "A", "A")
 
105
    checkGroupPrio(A, "A", 0)
 
106
    checkGroupDesc(A, "B", "Group B is the group that contains functions starting with b")
 
107
    checkGroupName(A, "B", "Group B has a nice new name and a high priority")
 
108
    checkGroupPrio(A, "B", -10)
 
109
    checkGroupName(A, "Z", "From owner chain")
 
110
 
 
111
    checkGroupDesc(B, "C", "Group C is introduced by B")
 
112
    checkGroupName(B, "C", "C")
 
113
    checkGroupPrio(B, "C", 0)
 
114
    checkGroupName(B, "Z", "From owner chain")
 
115
 
 
116
    checkGroupDesc(C, "A", "Group A is the group that contains functions starting with f")
 
117
    checkGroupName(C, "A", "A")
 
118
    checkGroupPrio(C, "A", 0)
 
119
    checkGroupDesc(C, "B", "Look ma, I'm overriding group descriptions!!!")
 
120
    checkGroupName(C, "B", "And names")
 
121
    checkGroupPrio(C, "B", -10)
 
122
    checkGroupDesc(C, "C", "Group C is introduced by B")
 
123
    checkGroupName(C, "C", "C")
 
124
    checkGroupPrio(C, "C", 0)
 
125
    checkGroupName(C, "Z", "From owner chain")
 
126
  }
 
127
}
 
 
b'\\ No newline at end of file'