Update Iot.js
[platform/upstream/iotjs.git] / test / run_pass / test_fs_readfile.js
1 /* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16
17 var fs = require('fs');
18 var assert = require('assert');
19
20 var filePath = "../resources/tobeornottobe.txt";
21
22 fs.readFile(filePath, function(err, data) {
23   assert.equal(err, null);
24   var result =
25   "To be, or not to be, that is the Question:\n" +
26   "Whether ’tis Nobler in the mind to ſuffer\n" +
27   "The Slings and Arrows of outragious Fortune,\n" +
28   "Or to take Armes against a Sea of troubles,\n" +
29   "And by opposing end them: to dye, to ſleepe\n" +
30   "No more; and by a sleep, to say we end\n" +
31   "The Heart-ake, and the thouſand Naturall ſhockes\n" +
32   'That Flesh is there too? "Tis a consummation\n' +
33   "Deuoutly to be wiſh'd. To dye to sleepe,\n" +
34   "To sleep, perchance to Dream; I, there's the rub,\n" +
35   "For in that sleep of death, what dreams may come,\n" +
36   "When we haue ſhufflel’d off this mortall coile,\n" +
37   "Muſt giue us pause. There's the respect\n" +
38   "That makes Calamity of long life:\n" +
39   "For who would beare the Whips and Scornes of time,\n" +
40   "The Oppreſſors wrong, the poore mans Contumely,\n" +
41   "The pangs of diſpriz’d Loue, the Lawes delay,\n" +
42   "The inſolence of Office, and the Spurnes\n" +
43   "That patient merit of the vnworthy takes,\n" +
44   "When he himſelfe might his Quietus make\n" +
45   "With a bare Bodkin? Who would theſe Fardles beare\n" +
46   "To grunt and ſweat vnder a weary life,\n" +
47   "But that the dread of ſomething after death,\n" +
48   "The vndiſcouered Countrey, from whoſe Borne\n" +
49   "No Traueller returnes, Puzels the will,\n" +
50   "And makes vs rather beare those illes we haue,\n" +
51   "Then flye to others that we know not of.\n" +
52   "Thus Conſcience does make Cowards of vs all,\n" +
53   "And thus the Natiue hew of Resolution\n" +
54   "Is ſicklied o’re, with the pale caſt of Thought,\n" +
55   "And enterprizes of great pith and moment,\n" +
56   "With this regard their Currants turne away,\n" +
57   "And looſe the name of Action. Soft you now,\n" +
58   "The faire Ophelia? Nimph, in thy Orizons\n" +
59   "Be all my ſinnes remembred."
60   assert.equal(data, result);
61 });