/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.j2cl.transpiler.integration.stringescapecodes;

/**
 * Test String escape codes.
 */
public class Main {
  public static void main(String... args) {
    testGeneralEscapes();
    testUnicodeEscapes();
  }

  private static void testUnicodeEscapes() {
    assert "\uD800\uDF46".equals("𐍆");
    assert "\u0000".length() == 1;
  }

  private static void testGeneralEscapes() {
    assert "".length() == 0;
    assert "\b".length() == 1;
    assert "\f".length() == 1;
    assert "\n".length() == 1;
    assert "\r".length() == 1;
    assert "\t".length() == 1;
    assert "\\".length() == 1;
    assert "\"".length() == 1;
    assert "\'".length() == 1;
  }
}

/*
 * Copyright 2015 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.j2cl.transpiler.integration.stringescapecodes;

/**
 * Test String escape codes.
 */
public class Main {
  public static void main(String... args) {
    testGeneralEscapes();
    testUnicodeEscapes();
    testOctalEscapes();
  }

  private static void testUnicodeEscapes() {
    assert "\uD800\uDF46".equals("𐍆");
    assert "\u0000".length() == 1;
  }

  private static void testGeneralEscapes() {
    assert "".length() == 0;
    assert "\b".length() == 1;
    assert "\f".length() == 1;
    assert "\n".length() == 1;
    assert "\r".length() == 1;
    assert "\t".length() == 1;
    assert "\\".length() == 1;
    assert "\"".length() == 1;
    assert "\'".length() == 1;
  }

  private static void testOctalEscapes() {
    // TODO(b/34685920): uncomment when octal escape codes are transformed to avoid jscompiler
    // strict check.
    // assert "\u001b[31m".equals("\033[31m");
  }
}

Add (disabled) test for strings with octal escapes.