Преглед на файлове

Merge branch 'feature/coolkids' of mdszy/memeforth into master

master
mark Gitea преди 7 месеца
родител
ревизия
1aa6473101
променени са 3 файла, в които са добавени 34 реда и са изтрити 7 реда
  1. +5
    -0
      DICTIONARY.md
  2. +8
    -3
      dictionary.js
  3. +21
    -4
      test/memeforth.test.js

+ 5
- 0
DICTIONARY.md Целия файл

@@ -55,6 +55,8 @@ NOTE: See JS docs for how output is handled and how to access it. It is *not* pr
Push an empty string to the stack.
* `SPACE`
Push a single space character to the stack.
* `\n`
Push a single newline character to the stack.
* `(` Starts a comment until a closing `)`

Not sure why this is in literals, but there's nowhere else that it really fits, so who cares.
@@ -125,6 +127,9 @@ This is what you're really here for.
* `CLAP`
Converts a string into `clapping👏text👏like👏this👏`.

* `COOLKIDS`
`yeet COOLKIDS` ⇒ `"all the cool kids are getting into yeet"`

* `DNS`
Generates a "DNS over" meme.


+ 8
- 3
dictionary.js Целия файл

@@ -698,13 +698,18 @@ const dictionary = {
TOUPPER: toUpper,
TOLOWER: toLower,
"+!": "DUP @ ROT + SWAP !".split(" "),
AAS: 'DUP 0 1 SLICE aaS CONCAT SWAP s" as a Service)" CONCAT s" (" SWAP CONCAT SWAP SPACE CONCAT SWAP CONCAT'.split(" "),
AAS: 'DUP 0 1 SLICE aaS CONCAT SWAP s" as a Service)" CONCAT s" (" SWAP CONCAT SWAP SPACE CONCAT SWAP CONCAT'.split(
" "
),
B_EMOJI: ["🅱️"],
BMOJI: "DUP LEN 1 SWAP SLICE B_EMOJI SWAP CONCAT".split(" "),
CLAP_EMOJI: ["👏"],
CLAP: "SPACE SPLIT CLAP_EMOJI JOIN CLAP_EMOJI CONCAT".split(" "),
OWNING: 's" and " SWAP CONCAT CONCAT s" owning the " ROT CONCAT s" with " CONCAT SWAP CONCAT'.split(" ")

OWNING: 's" and " SWAP CONCAT CONCAT s" owning the " ROT CONCAT s" with " CONCAT SWAP CONCAT'.split(
" "
),
COOLKIDS: 's" all the cool kids are getting into " SWAP CONCAT'.split(" "),
"\\n": 's" \n"'.split(" ")
};

module.exports = dictionary;

+ 21
- 4
test/memeforth.test.js Целия файл

@@ -60,7 +60,17 @@ describe("interpreter", () => {
expect(mf.run('s" " s" test" ').stack.stackArr).to.eql(["", "test"]);
});

it("should add empty strings with BLANK", () => {});
it("should add empty strings with BLANK", () => {
expect(mf.run("BLANK").stack.stackArr).to.eql([""])
});

it("should add spaces with SPACE", () => {
expect(mf.run("SPACE").stack.stackArr).to.eql([" "])
});

it("should add newlines with \\n", () => {
expect(mf.run("\\n").stack.stackArr).to.eql(["\n"])
});
});

describe("comparison", () => {
@@ -296,6 +306,13 @@ describe("interpreter", () => {
"owning the memeforth with units and tests"
);
});

it("should run COOLKIDS command", () => {
const prog = "yeet COOLKIDS";
expect(mf.run(prog).stack.stackArr[0]).to.be(
"all the cool kids are getting into yeet"
);
});
});

describe("string functions", () => {
@@ -461,9 +478,9 @@ describe("interpreter", () => {
});

it("should run ROT command", () => {
expect(mf.run('s" test1" s" test2" s" test3" ROT').stack.stackArr).to.eql(
["test2", "test3", "test1"]
);
expect(
mf.run('s" test1" s" test2" s" test3" ROT').stack.stackArr
).to.eql(["test2", "test3", "test1"]);
});

it("should run -ROT command", () => {


Loading…
Отказ
Запис