Debian Codegraph @

tests/missing/missing.html

raw
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>almond: No Name Test</title>
5 <script type="text/javascript" src="../doh/runner.js"></script>
6 <script type="text/javascript" src="../doh/_browserRunner.js"></script>
7 <script type="text/javascript" src="../../almond.js"></script>
8 <script type="text/javascript">
9 doh.register(
10 'noname',
11 [
12 function noname(t){
13 var err;
14
15 try {
16 define('depArray', ['missing'], function (missing) {
17 console.log('what? ' + missing);
18 });
19 require('depArray');
20 } catch(e) {
21 err = e;
22 }
23
24 t.is(true, err.toString().indexOf(' missing ') !== -1, 'dep array throws');
25 err = null;
26
27 try {
28 define('sugar', function (require) {
29 var missing = require('missing');
30 return {
31 name: 'sugar'
32 };
33 });
34
35 require('sugar');
36 } catch (e) {
37 err = e;
38 }
39
40 t.is(true, err.toString().indexOf('No missing') !== -1, 'sugar throws');
41
42 }
43 ]
44 );
45 doh.run();
46 </script>
47 </head>
48 <body>
49 <h1>almond: No Name Test</h1>
50 <p>Test that an error from a missing name for a define gives a usuable
51 message. Only catches some cases of this though.</p>
52 <p>Check console for messages</p>
53 </body>
54 </html>