nadesiko3 3.2.51 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cnako3 +1 -1
- package/bin/cnako3.bat +1 -1
- package/demo/browsers.html +9 -10
- package/demo/flow.html +1 -0
- package/demo/turtle3.html +18 -17
- package/demo/turtle3d.html +1 -1
- package/demo/turtle3d2.html +1 -1
- package/doc/browsers.md +9 -10
- package/package.json +58 -57
- package/release/_hash.txt +57 -52
- package/release/_script-tags.txt +14 -13
- package/release/command.json +1 -1
- package/release/command.json.js +1 -1
- package/release/command_cnako3.json +1 -1
- package/release/command_list.json +1 -1
- package/release/editor.js +1 -1
- package/release/editor.js.LICENSE.txt +9 -12
- package/release/nako_gen_async.js +1 -1
- package/release/nako_gen_async.js.LICENSE.txt +10 -666
- package/release/plugin_caniuse.js +1 -1
- package/release/plugin_caniuse.js.LICENSE.txt +9 -425
- package/release/plugin_csv.js +1 -1
- package/release/plugin_csv.js.LICENSE.txt +3 -419
- package/release/plugin_datetime.js +1 -1
- package/release/plugin_datetime.js.LICENSE.txt +6 -530
- package/release/plugin_kansuji.js +1 -1
- package/release/plugin_kansuji.js.LICENSE.txt +3 -559
- package/release/plugin_markup.js +1 -1
- package/release/plugin_markup.js.LICENSE.txt +4 -420
- package/release/plugin_turtle.js +1 -1
- package/release/plugin_turtle.js.LICENSE.txt +12 -500
- package/release/plugin_webworker.js +1 -1
- package/release/plugin_webworker.js.LICENSE.txt +3 -563
- package/release/plugin_weykturtle3d.js +1 -0
- package/release/stats.json +1 -1
- package/release/version.js +1 -1
- package/release/version.js.LICENSE.txt +9 -12
- package/release/wnako3.js +1 -1
- package/release/wnako3.js.LICENSE.txt +1 -1
- package/release/wnako3webworker.js +1 -1
- package/release/wnako3webworker.js.LICENSE.txt +1 -1117
- package/src/browsers.mjs +1 -0
- package/src/browsers.txt +15 -15
- package/src/browsers_agents.mjs +1 -0
- package/src/cnako3.mjs +13 -0
- package/src/{cnako3.js → cnako3mod.mjs} +46 -53
- package/src/{commander_ja.js → commander_ja.mjs} +16 -11
- package/src/{enako3.js → enako3.mjs} +0 -0
- package/src/{era.json → era.mjs} +1 -1
- package/src/image_turtle-elephant.mjs +5 -0
- package/src/image_turtle-panda.mjs +5 -0
- package/src/image_turtle64.mjs +5 -0
- package/src/index.mjs +9 -0
- package/src/{nako3.js → nako3.mjs} +56 -52
- package/src/{nako3_assert.js → nako3_assert.mjs} +7 -6
- package/src/{nako3server.js → nako3server.mjs} +12 -5
- package/src/{nako_colors.js → nako_colors.mjs} +1 -1
- package/src/{nako_errors.js → nako_errors.mjs} +8 -18
- package/src/{nako_from_dncl.js → nako_from_dncl.mjs} +8 -6
- package/src/{nako_gen.js → nako_gen.mjs} +107 -89
- package/src/{nako_gen_async.js → nako_gen_async.mjs} +5 -8
- package/src/{nako_global.js → nako_global.mjs} +4 -5
- package/src/{nako_indent.js → nako_indent.mjs} +4 -4
- package/src/{nako_josi_list.js → nako_josi_list.mjs} +16 -14
- package/src/nako_lex_rules.mjs +244 -0
- package/src/{nako_lexer.js → nako_lexer.mjs} +7 -10
- package/src/{nako_logger.js → nako_logger.mjs} +3 -4
- package/src/{nako_parser3.js → nako_parser3.mjs} +5 -5
- package/src/{nako_parser_base.js → nako_parser_base.mjs} +1 -9
- package/src/{nako_parser_const.js → nako_parser_const.mjs} +2 -6
- package/src/{nako_prepare.js → nako_prepare.mjs} +1 -2
- package/src/{nako_reserved_words.js → nako_reserved_words.mjs} +1 -1
- package/src/{nako_source_mapping.js → nako_source_mapping.mjs} +4 -11
- package/src/{nako_test.js → nako_test.mjs} +0 -0
- package/src/nako_version.mjs +7 -0
- package/src/{plugin_browser.js → plugin_browser.mjs} +30 -30
- package/src/{plugin_browser_ajax.js → plugin_browser_ajax.mjs} +7 -7
- package/src/{plugin_browser_audio.js → plugin_browser_audio.mjs} +1 -1
- package/src/{plugin_browser_canvas.js → plugin_browser_canvas.mjs} +1 -1
- package/src/{plugin_browser_chart.js → plugin_browser_chart.mjs} +1 -1
- package/src/{plugin_browser_color.js → plugin_browser_color.mjs} +1 -1
- package/src/{plugin_browser_crypto.js → plugin_browser_crypto.mjs} +1 -1
- package/src/{plugin_browser_dialog.js → plugin_browser_dialog.mjs} +1 -1
- package/src/{plugin_browser_dom_basic.js → plugin_browser_dom_basic.mjs} +1 -1
- package/src/{plugin_browser_dom_event.js → plugin_browser_dom_event.mjs} +1 -1
- package/src/{plugin_browser_dom_parts.js → plugin_browser_dom_parts.mjs} +1 -1
- package/src/{plugin_browser_geolocation.js → plugin_browser_geolocation.mjs} +1 -1
- package/src/{plugin_browser_hotkey.js → plugin_browser_hotkey.mjs} +2 -2
- package/src/{plugin_browser_html.js → plugin_browser_html.mjs} +1 -1
- package/src/{plugin_browser_in_worker.js → plugin_browser_in_worker.mjs} +4 -4
- package/src/{plugin_browser_location.js → plugin_browser_location.mjs} +1 -1
- package/src/{plugin_browser_speech.js → plugin_browser_speech.mjs} +1 -1
- package/src/{plugin_browser_storage.js → plugin_browser_storage.mjs} +1 -1
- package/src/{plugin_browser_system.js → plugin_browser_system.mjs} +1 -1
- package/src/{plugin_browser_websocket.js → plugin_browser_websocket.mjs} +1 -1
- package/src/{plugin_caniuse.js → plugin_caniuse.mjs} +8 -3
- package/src/{plugin_csv.js → plugin_csv.mjs} +4 -5
- package/src/{plugin_datetime.js → plugin_datetime.mjs} +19 -26
- package/src/{plugin_express.js → plugin_express.mjs} +4 -3
- package/src/{plugin_kansuji.js → plugin_kansuji.mjs} +1 -1
- package/src/{plugin_keigo.js → plugin_keigo.mjs} +0 -0
- package/src/{plugin_markup.js → plugin_markup.mjs} +6 -6
- package/src/{plugin_math.js → plugin_math.mjs} +1 -4
- package/src/{plugin_node.js → plugin_node.mjs} +25 -57
- package/src/{plugin_promise.js → plugin_promise.mjs} +1 -3
- package/src/{plugin_system.js → plugin_system.mjs} +32 -15
- package/src/{plugin_test.js → plugin_test.mjs} +1 -3
- package/src/{plugin_turtle.js → plugin_turtle.mjs} +5 -4
- package/src/{plugin_webworker.js → plugin_webworker.mjs} +3 -3
- package/src/{plugin_weykturtle3d.js → plugin_weykturtle3d.mjs} +1 -3
- package/src/{plugin_worker.js → plugin_worker.mjs} +4 -1
- package/src/{wnako3.js → wnako3.mjs} +5 -5
- package/src/{wnako3_editor.js → wnako3_editor.mjs} +24 -18
- package/src/{wnako3webworker.js → wnako3webworker.mjs} +0 -0
- package/test/async/{async_basic_test.js → async_basic_test.mjs} +3 -4
- package/test/browser/karma.config.js +9 -0
- package/test/browser/test/plugin_browser_test.js +2 -2
- package/test/browser/test/plugin_turtle_test.js +2 -2
- package/test/browser/test/plugin_webworker_test.js +3 -3
- package/test/browser/test/require_test.js +2 -2
- package/test/common/{array_test.js → array_test.mjs} +3 -3
- package/test/common/{basic_test.js → basic_test.mjs} +3 -13
- package/test/common/{calc_test.js → calc_test.mjs} +2 -2
- package/test/common/{debug_test.js → debug_test.mjs} +2 -2
- package/test/common/{dncl_test.js → dncl_test.mjs} +3 -3
- package/test/common/{error_test.js → error_test.mjs} +2 -2
- package/test/common/{flow_test.js → flow_test.mjs} +2 -2
- package/test/common/{func_call.js → func_call.mjs} +3 -3
- package/test/common/{func_test.js → func_test.mjs} +2 -2
- package/test/common/{indent_test.js → indent_test.mjs} +3 -2
- package/test/common/{lex_test.js → lex_test.mjs} +2 -2
- package/test/common/{literal_test.js → literal_test.mjs} +3 -2
- package/test/common/{nako_logger_test.js → nako_logger_test.mjs} +3 -3
- package/test/common/{plugin_browser_test.js → plugin_browser_test.mjs} +4 -4
- package/test/common/{plugin_browser_ut_audio_test.js → plugin_browser_ut_audio_test.mjs} +4 -4
- package/test/common/{plugin_browser_ut_color_test.js → plugin_browser_ut_color_test.mjs} +2 -2
- package/test/common/{plugin_browser_ut_dialog_test.js → plugin_browser_ut_dialog_test.mjs} +3 -3
- package/test/common/{plugin_browser_ut_html_test.js → plugin_browser_ut_html_test.mjs} +2 -2
- package/test/common/{plugin_browser_ut_system_test.js → plugin_browser_ut_system_test.mjs} +2 -2
- package/test/common/{plugin_csv_test.js → plugin_csv_test.mjs} +3 -3
- package/test/common/{plugin_datetime_test.js → plugin_datetime_test.mjs} +4 -4
- package/test/common/{plugin_kansuji_test.js → plugin_kansuji_test.mjs} +3 -3
- package/test/common/{plugin_markup_test.js → plugin_markup_test.mjs} +3 -3
- package/test/common/{plugin_promise_test.js → plugin_promise_test.mjs} +2 -2
- package/test/common/{plugin_system_test.js → plugin_system_test.mjs} +2 -2
- package/test/common/{prepare_test.js → prepare_test.mjs} +2 -2
- package/test/common/{re_test.js → re_test.mjs} +2 -2
- package/test/common/{variable_scope_test.js → variable_scope_test.mjs} +2 -2
- package/test/karma.config.js +3 -3
- package/test/node/{async_test.js → async_test.mjs} +4 -2
- package/test/node/{commander_ja_test.js → commander_ja_test.mjs} +17 -12
- package/test/node/{error_message_test.js → error_message_test.mjs} +13 -10
- package/test/node/node_test.mjs +57 -0
- package/test/node/{plugin_browser_ut_ajax_test.js → plugin_browser_ut_ajax_test.mjs} +7 -5
- package/test/node/{plugin_browser_ut_location_test.js → plugin_browser_ut_location_test.mjs} +3 -3
- package/test/node/{plugin_markup_test.js → plugin_markup_test.mjs} +6 -7
- package/test/node/{plugin_math_test.js → plugin_math_test.mjs} +5 -5
- package/test/node/{plugin_node_test.js → plugin_node_test.mjs} +11 -7
- package/test/node/{plugin_test.js → plugin_test.mjs} +11 -5
- package/test/node/{require_nako3_test.js → require_nako3_test.mjs} +19 -12
- package/test/node/{side_effects_test.js → side_effects_test.mjs} +24 -13
- package/test/node/{wnako3_editor_test.js → wnako3_editor_test.mjs} +16 -9
- package/tools/nako3edit/index.nako3 +1 -1
- package/tools/nako3edit/{run.js → run.mjs} +8 -2
- package/src/index.js +0 -5
- package/src/nako_lex_rules.js +0 -260
- package/src/nako_version.js +0 -8
- package/test/node/node_test.js +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import { NakoDncl } from '../../src/nako_from_dncl.mjs'
|
|
4
4
|
|
|
5
5
|
describe('dncl (#1140)', () => {
|
|
6
6
|
const cmp = (src, expected) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import { NakoSyntaxError } from '../../src/nako_errors.mjs'
|
|
4
4
|
|
|
5
5
|
describe('関数呼び出しテスト', () => {
|
|
6
6
|
const nako = new NakoCompiler()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import NakoIndent from '../../src/nako_indent.mjs'
|
|
3
4
|
|
|
4
5
|
describe('indent', () => {
|
|
5
6
|
const cmp = (src, expected) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
|
|
3
4
|
describe('literal_test', () => {
|
|
4
5
|
const nako = new NakoCompiler()
|
|
5
6
|
// nako.logger.addListener('trace', ({ browserConsole }) => { console.log(...browserConsole) })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoColors } from '../../src/nako_colors.mjs'
|
|
3
|
+
import { NakoLogger } from '../../src/nako_logger.mjs'
|
|
4
4
|
|
|
5
5
|
describe('nako_logger_test', () => {
|
|
6
6
|
it('色付けのテスト', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
4
4
|
|
|
5
5
|
describe('plugin_browser_test', () => {
|
|
6
|
-
const nako = new NakoCompiler()
|
|
6
|
+
const nako = new NakoCompiler({useBasicPlugin: true})
|
|
7
7
|
// nako.logger.addListener('trace', ({ browserConsole }) => { console.log(...browserConsole) })
|
|
8
8
|
nako.addPluginFile('PluginBrowser', 'plugin_browser.js', PluginBrowser)
|
|
9
9
|
const cmp = (code, res) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as td from 'testdouble'
|
|
2
|
+
import assert from 'assert'
|
|
3
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
4
|
+
import { PluginUtHelper } from '../../utils/plugin_ut_helper.js'
|
|
5
5
|
|
|
6
6
|
class StubAudio {
|
|
7
7
|
contructor () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
2
|
+
import { PluginUtHelper } from '../../utils/plugin_ut_helper.js'
|
|
3
3
|
|
|
4
4
|
describe('plugin_browser_color', () => {
|
|
5
5
|
const cu = new PluginUtHelper(PluginBrowser)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as td from 'testdouble'
|
|
2
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
3
|
+
import assert from 'assert'
|
|
4
4
|
|
|
5
5
|
describe('plugin_browser_dialog', () => {
|
|
6
6
|
describe('言う', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
2
|
+
import { PluginUtHelper } from '../../utils/plugin_ut_helper.js'
|
|
3
3
|
|
|
4
4
|
describe('plugin_browser_html', () => {
|
|
5
5
|
const cu = new PluginUtHelper(PluginBrowser)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import PluginBrowser from '../../src/plugin_browser.mjs'
|
|
2
|
+
import { PluginUtHelper } from '../../utils/plugin_ut_helper.js'
|
|
3
3
|
|
|
4
4
|
describe('plugin_browser_system', () => {
|
|
5
5
|
const cu = new PluginUtHelper(PluginBrowser)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import PluginCSV from '../../src/plugin_csv.mjs'
|
|
4
4
|
|
|
5
5
|
describe('plugin_csv_test', () => {
|
|
6
6
|
const nako = new NakoCompiler()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import {NakoRuntimeError} from '../../src/nako_errors.mjs'
|
|
4
|
+
import PluginDateTime from '../../src/plugin_datetime.mjs'
|
|
5
5
|
|
|
6
6
|
describe('plugin_datetime_test', () => {
|
|
7
7
|
const nako = new NakoCompiler()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import PluginKansuji from '../../src/plugin_kansuji.mjs'
|
|
4
4
|
|
|
5
5
|
describe('plugin_kansuji_test', () => {
|
|
6
6
|
const nako = new NakoCompiler()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.mjs'
|
|
3
|
+
import PluginMarkup from '../../src/plugin_markup.mjs'
|
|
4
4
|
|
|
5
5
|
describe('plugin_markup_test', () => {
|
|
6
6
|
const nako = new NakoCompiler()
|
package/test/karma.config.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = function(config) {
|
|
|
5
5
|
basePath: '',
|
|
6
6
|
frameworks: ['mocha','webpack'],
|
|
7
7
|
files: [
|
|
8
|
-
'common/*.
|
|
8
|
+
'common/*.mjs'
|
|
9
9
|
],
|
|
10
10
|
plugins: [
|
|
11
11
|
'karma-firefox-launcher',
|
|
@@ -32,7 +32,7 @@ module.exports = function(config) {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
preprocessors: {
|
|
35
|
-
'common/*.
|
|
35
|
+
'common/*.mjs': ['webpack']
|
|
36
36
|
},
|
|
37
37
|
// webpackの設定
|
|
38
38
|
webpack: {
|
|
@@ -41,7 +41,7 @@ module.exports = function(config) {
|
|
|
41
41
|
module: {
|
|
42
42
|
rules: [
|
|
43
43
|
{
|
|
44
|
-
test: /\.js$/,
|
|
44
|
+
test: /\.(js|mjs)$/,
|
|
45
45
|
exclude: /(node_modules|bower_components)/,
|
|
46
46
|
use: { loader: 'babel-loader' }
|
|
47
47
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.js'
|
|
3
|
+
import { Nako3Assert } from '../../src/nako3_assert.js'
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
describe('async_test', () => {
|
|
5
7
|
const debug = false
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import app from '../../src/commander_ja.js'
|
|
2
3
|
|
|
3
4
|
describe('commnder_ja', () => {
|
|
4
5
|
it('version', () => {
|
|
5
|
-
|
|
6
|
+
app.reset()
|
|
6
7
|
const c1 = app
|
|
7
8
|
.version('1.1.1', '-v,--version')
|
|
8
9
|
.option('-a,--aaa')
|
|
9
10
|
.parseStr(['node.js', 'cnako3.js', '-v'])
|
|
10
11
|
assert.strictEqual(c1, '1.1.1')
|
|
12
|
+
|
|
13
|
+
app.reset()
|
|
11
14
|
const c2 = app
|
|
12
15
|
.version('1.2.3', '-v,--version')
|
|
13
16
|
.option('-a,--aaa')
|
|
@@ -15,16 +18,18 @@ describe('commnder_ja', () => {
|
|
|
15
18
|
assert.strictEqual(c2, '1.2.3')
|
|
16
19
|
})
|
|
17
20
|
it('help', () => {
|
|
18
|
-
|
|
21
|
+
app.reset()
|
|
19
22
|
app.version('1.2.3', '-v,--version')
|
|
20
23
|
.usage('[opt] test')
|
|
21
|
-
.option('-a,--aaa')
|
|
22
|
-
const
|
|
24
|
+
.option('-a,--aaa', 'hoge')
|
|
25
|
+
const helpStr = app.getHelp()
|
|
23
26
|
const c1 = app.parseStr(['node.js', 'cnako3.js', '-h'])
|
|
24
|
-
|
|
27
|
+
const a = helpStr.replace(/\s$/g, '')
|
|
28
|
+
const b= c1.replace(/\s$/g, '')
|
|
29
|
+
assert.strictEqual(a, b)
|
|
25
30
|
})
|
|
26
31
|
it('args no params', () => {
|
|
27
|
-
|
|
32
|
+
app.reset()
|
|
28
33
|
app.version('1.2.3', '-v,--version')
|
|
29
34
|
.title('hoge')
|
|
30
35
|
.usage('[opt] test')
|
|
@@ -34,7 +39,7 @@ describe('commnder_ja', () => {
|
|
|
34
39
|
assert.strictEqual(app.args[1], 'bbb')
|
|
35
40
|
})
|
|
36
41
|
it('args has params1', () => {
|
|
37
|
-
|
|
42
|
+
app.reset()
|
|
38
43
|
app.version('1.2.3', '-v,--version')
|
|
39
44
|
.title('hoge')
|
|
40
45
|
.usage('[opt] test')
|
|
@@ -43,7 +48,7 @@ describe('commnder_ja', () => {
|
|
|
43
48
|
assert.strictEqual(app.aaa, true)
|
|
44
49
|
})
|
|
45
50
|
it('args has params2', () => {
|
|
46
|
-
|
|
51
|
+
app.reset()
|
|
47
52
|
app.version('1.2.3', '-v,--version')
|
|
48
53
|
.title('hoge')
|
|
49
54
|
.usage('[opt] test')
|
|
@@ -53,7 +58,7 @@ describe('commnder_ja', () => {
|
|
|
53
58
|
assert.strictEqual(app.args[0], 'bbb')
|
|
54
59
|
})
|
|
55
60
|
it('args has params3', () => {
|
|
56
|
-
|
|
61
|
+
app.reset()
|
|
57
62
|
app.version('1.2.3', '-v,--version')
|
|
58
63
|
.title('hoge')
|
|
59
64
|
.usage('[opt] test')
|
|
@@ -62,7 +67,7 @@ describe('commnder_ja', () => {
|
|
|
62
67
|
assert.strictEqual(app.eval, 'hoge')
|
|
63
68
|
})
|
|
64
69
|
it('args has params4', () => {
|
|
65
|
-
|
|
70
|
+
app.reset()
|
|
66
71
|
app.version('1.2.3', '-v,--version')
|
|
67
72
|
.usage('[opt] test')
|
|
68
73
|
.option('-e, --eval [source]', 'eval source')
|
|
@@ -70,7 +75,7 @@ describe('commnder_ja', () => {
|
|
|
70
75
|
assert.strictEqual(app.eval, '')
|
|
71
76
|
})
|
|
72
77
|
it('args has params5', () => {
|
|
73
|
-
|
|
78
|
+
app.reset()
|
|
74
79
|
app.version('1.2.3', '-v,--version')
|
|
75
80
|
.usage('[opt] test')
|
|
76
81
|
.option('-e, --eval [source]', 'eval source')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { NakoCompiler } from '../../src/nako3.js'
|
|
4
|
+
import { NakoSyntaxError, NakoRuntimeError, NakoIndentError, NakoLexerError } from '../../src/nako_errors.js'
|
|
5
|
+
import { CNako3 } from '../../src/cnako3mod.js'
|
|
6
6
|
|
|
7
7
|
describe('error_message', () => {
|
|
8
8
|
const nako = new NakoCompiler()
|
|
@@ -12,9 +12,9 @@ describe('error_message', () => {
|
|
|
12
12
|
*/
|
|
13
13
|
const cmp = (code, resArr, ErrorClass, _nako = nako) => {
|
|
14
14
|
_nako.logger.debug('code=' + code)
|
|
15
|
-
assert.
|
|
16
|
-
() => _nako.run(code, path.join(__dirname, 'main.nako3')),
|
|
17
|
-
err => {
|
|
15
|
+
assert.rejects(
|
|
16
|
+
async () => await _nako.run(code, path.join(__dirname, 'main.nako3')),
|
|
17
|
+
(err) => {
|
|
18
18
|
assert(err instanceof ErrorClass)
|
|
19
19
|
for (const res of resArr) {
|
|
20
20
|
if (!err.message.includes(res)) {
|
|
@@ -170,14 +170,16 @@ describe('error_message', () => {
|
|
|
170
170
|
const nako = new NakoCompiler()
|
|
171
171
|
const code = nako.compileStandalone('10のエラー発生')
|
|
172
172
|
const silent = 'const console = { error() {} };\n'
|
|
173
|
-
assert.
|
|
174
|
-
() => new Function(silent + code)(),
|
|
173
|
+
assert.rejects(
|
|
174
|
+
async () => await (new Function(silent + code)()),
|
|
175
175
|
(err) => {
|
|
176
176
|
assert.strictEqual(err.message.split('\n')[0], '[実行時エラー](1行目): エラー『10』が発生しました。')
|
|
177
177
|
return true
|
|
178
178
|
},
|
|
179
179
|
)
|
|
180
180
|
})
|
|
181
|
+
/*
|
|
182
|
+
// 生成される standalone コードが cjs なのでパス
|
|
181
183
|
it('JavaScriptのみで動くコードの場合 - 「秒後」内の場合', function (done) {
|
|
182
184
|
if (process.env.NODE_ENV === 'test') {return this.skip()}
|
|
183
185
|
const nako = new NakoCompiler()
|
|
@@ -188,6 +190,7 @@ describe('error_message', () => {
|
|
|
188
190
|
}
|
|
189
191
|
})
|
|
190
192
|
})
|
|
193
|
+
*/
|
|
191
194
|
})
|
|
192
195
|
describe('インデント構文のエラー', () => {
|
|
193
196
|
it('『ここまで』を使用', () => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import { execSync, spawnSync } from 'child_process'
|
|
5
|
+
import NakoVersion from '../../src/nako_version.js'
|
|
6
|
+
const debug = false
|
|
7
|
+
|
|
8
|
+
// __dirname のために
|
|
9
|
+
import url from 'url'
|
|
10
|
+
const __filename = url.fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
|
|
13
|
+
// PATH
|
|
14
|
+
const cnako3 = path.join(__dirname, '../../src/cnako3.js')
|
|
15
|
+
|
|
16
|
+
describe('node_test(cnako)', () => {
|
|
17
|
+
const cmp = (code, exRes) => {
|
|
18
|
+
const result = execSync(`node ${cnako3} -e "${code}"`).toString().replace(/\s+$/, '')
|
|
19
|
+
if (debug) {
|
|
20
|
+
console.log('code=' + code)
|
|
21
|
+
console.log('result=' + result)
|
|
22
|
+
}
|
|
23
|
+
assert.strictEqual(result, exRes)
|
|
24
|
+
}
|
|
25
|
+
// --- バージョンチェック ---
|
|
26
|
+
it('ナデシコバージョン:src/plugin_system.jsを正しく設定しているか?', () => {
|
|
27
|
+
cmp('ナデシコバージョンを表示', NakoVersion.version)
|
|
28
|
+
cmp('ナデシコ種類を表示', 'cnako3')
|
|
29
|
+
})
|
|
30
|
+
// --- test ---
|
|
31
|
+
it('print simple', () => {
|
|
32
|
+
cmp('3を表示', '3')
|
|
33
|
+
cmp('1+2*3を表示', '7')
|
|
34
|
+
cmp('A=30;「--{A}--」を表示', '--30--')
|
|
35
|
+
}).timeout(15000)
|
|
36
|
+
|
|
37
|
+
it('単独で実行できるプログラムの出力(macの時のみ) - Node.js', function () {
|
|
38
|
+
// [memo] 現状なでしこが生成するコードは cjs のもの
|
|
39
|
+
// testフォルダはmjsがデフォルト
|
|
40
|
+
// そのため、とりあえずwindowsならテストしない macの時だけテスト
|
|
41
|
+
if (process.platform != 'darwin') { return this.skip() }
|
|
42
|
+
const nakofileOrg = path.join(__dirname, 'add_test.nako3')
|
|
43
|
+
const nakofile = path.join('/tmp', 'add_test.nako3')
|
|
44
|
+
const jsfile = path.join('/tmp', 'add_test.js')
|
|
45
|
+
fs.copyFileSync(nakofileOrg, nakofile)
|
|
46
|
+
if (process.env.NODE_ENV === 'test') {return this.skip()}
|
|
47
|
+
const stderr = spawnSync('node', [cnako3, '-c', nakofile]).stderr
|
|
48
|
+
try {
|
|
49
|
+
if (stderr) { console.error(stderr.toString()) }
|
|
50
|
+
const p = spawnSync('node', [jsfile])
|
|
51
|
+
if (p.stderr) { console.error(p.stderr.toString()) }
|
|
52
|
+
assert.strictEqual(p.stdout.toString(), '3\n')
|
|
53
|
+
} finally {
|
|
54
|
+
if (fs.existsSync(jsfile)) { fs.unlinkSync(jsfile) }
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import PluginBrowser from '../../src/plugin_browser.js'
|
|
3
|
+
import { PluginUtHelper } from '../../utils/plugin_ut_helper.js'
|
|
4
|
+
|
|
5
|
+
import fetchMock from 'fetch-mock'
|
|
6
|
+
import FormDataBase from 'form-data'
|
|
7
|
+
|
|
6
8
|
class FormData extends FormDataBase {
|
|
7
9
|
constructor () {
|
|
8
10
|
super()
|
package/test/node/{plugin_browser_ut_location_test.js → plugin_browser_ut_location_test.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as td from 'testdouble'
|
|
2
|
+
import assert from 'assert'
|
|
3
|
+
import PluginBrowser from '../../src/plugin_browser.js'
|
|
4
4
|
|
|
5
5
|
describe('plugin_browser_location', () => {
|
|
6
6
|
describe('location-url', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.js'
|
|
3
|
+
import PluginMarkup from '../../src/plugin_markup.js'
|
|
4
|
+
import { CNako3 } from '../../src/cnako3mod.js'
|
|
5
5
|
|
|
6
6
|
describe('plugin_markup_test', () => {
|
|
7
7
|
const wnako = new NakoCompiler()
|
|
@@ -11,7 +11,7 @@ describe('plugin_markup_test', () => {
|
|
|
11
11
|
const cnako = new CNako3()
|
|
12
12
|
cnako.silent = true
|
|
13
13
|
|
|
14
|
-
const cmp = (code, res) => {
|
|
14
|
+
const cmp = async (code, res) => {
|
|
15
15
|
for (let nako of [cnako, wnako]) {
|
|
16
16
|
let c = code
|
|
17
17
|
|
|
@@ -20,8 +20,7 @@ describe('plugin_markup_test', () => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
nako.logger.debug('code=' + code)
|
|
23
|
-
|
|
24
|
-
assert.strictEqual(nako.run(c).log, res)
|
|
23
|
+
assert.strictEqual( (await nako.run(c)).log, res )
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.js'
|
|
3
|
+
import { CNako3 } from '../../src/cnako3mod.js'
|
|
4
4
|
|
|
5
5
|
describe('plugin_math_test', () => {
|
|
6
6
|
const wnako = new NakoCompiler()
|
|
@@ -9,11 +9,11 @@ describe('plugin_math_test', () => {
|
|
|
9
9
|
cnako.silent = true
|
|
10
10
|
// wnako.logger.addListener('trace', ({ nodeConsole }) => { console.log(nodeConsole) })
|
|
11
11
|
|
|
12
|
-
const cmp = (code, res) => {
|
|
12
|
+
const cmp = async (code, res) => {
|
|
13
13
|
for (let nako of [cnako, wnako]) {
|
|
14
14
|
let c = code
|
|
15
15
|
nako.logger.debug('code=' + code)
|
|
16
|
-
assert.strictEqual(nako.run(c).log, res)
|
|
16
|
+
assert.strictEqual((await nako.run(c)).log, res)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
import { NakoCompiler } from '../../src/nako3.js'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import PluginNode from '../../src/plugin_node.js'
|
|
5
|
+
import PluginCSV from '../../src/plugin_csv.js'
|
|
6
6
|
|
|
7
|
+
// __dirname のために
|
|
8
|
+
import url from 'url'
|
|
9
|
+
const __filename = url.fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
7
11
|
const testFileMe = path.join(__dirname, 'plugin_node_test.js')
|
|
8
12
|
|
|
9
13
|
describe('plugin_node_test', () => {
|
|
@@ -11,9 +15,9 @@ describe('plugin_node_test', () => {
|
|
|
11
15
|
// nako.logger.addListener('trace', ({ browserConsole }) => { console.log(...browserConsole) })
|
|
12
16
|
nako.addPluginFile('PluginNode', 'plugin_node.js', PluginNode)
|
|
13
17
|
nako.addPluginFile('PluginCSV', 'plugin_csv.js', PluginCSV)
|
|
14
|
-
const cmp = (code, res) => {
|
|
18
|
+
const cmp = async (code, res) => {
|
|
15
19
|
nako.logger.debug('code=' + code)
|
|
16
|
-
assert.strictEqual(nako.run(code).log, res)
|
|
20
|
+
assert.strictEqual((await nako.run(code)).log, res)
|
|
17
21
|
}
|
|
18
22
|
const cmd = (code) => {
|
|
19
23
|
nako.logger.debug('code=' + code)
|